Skip to content
Snippets Groups Projects
Commit 53f4fbd9 authored by Emmanuel ROHEE's avatar Emmanuel ROHEE
Browse files

resizeImage: generate an image in the format of the original image. (Tested...

resizeImage: generate an image in the format of the original image. (Tested with tranparent PNG, transparent GIF, BMP, JPEG)
parent c8d0c476
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,9 @@ angular.module('mUtilities', [])
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
var dataUrl = canvas.toDataURL("image/jpeg", 0.7);
// Extract image data in the same format as the original one.
// The 0.7 compression value will work with formats that supports it like JPEG.
var dataUrl = canvas.toDataURL(imageFile.type, 0.7);
deferred.resolve(self.dataURItoBlob(dataUrl));
};
img.onerror = function(e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment