@huchengtw-moz, @davidflanagan  

[djf:]If pickType !== pickedFile.type (if we're converting a jpeg to a png, for example) then pickedFile.name will probably include a file extension that does not match the new file type.

[punam] Checked and the above scenario will happen only if pickedFile.type is 'image/gif' as canvas.toBlob inside getCroppedRegionBlob 
https://github.com/mozilla-b2g/gaia/blob/master/apps/gallery/js/ImageEditor.js#L1354
takes type as an argument which ensures blob.type returned is of the same type as pickType. 

Canvas.toBlob returns http://jsfiddle.net/vvaUw/1/ (thanks john!)
1. image/bmp for type image/bmp
2. image/jpeg for type, image/jpeg
3. image/png for type, image/png
4. image/png for type, image/gif

Also because of this snippet of code, https://github.com/mozilla-b2g/gaia/blob/master/apps/gallery/js/gallery.js#L880 before cropping an image we always have  pickType === pickedFile.type.

It's the blob.type that returns after cropping !==pickedFile.type for GIF images only even though pickType is image/gif, and filename returned has a .gif extension.

So I propose checking blob.type for gif images and appending .png extension e.g. foo.gif.png and returning pickType  as image/png. I will make it generic so that in future if canvas.toBlob stops handling a particular mimetype correctly, our code still return correct filenames and picktype for the cropped blob.