Closed Bug 900425 Opened 11 years ago Closed 11 years ago

Photo is rotated showing not correctly/Please Rotate picture by its orientation metadata

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

ARM
Gonk (Firefox OS)
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: renfeng.mei, Assigned: heroldtom)

References

Details

Attachments

(7 files, 1 obsolete file)

Attached image IMG_0001.jpg (deleted) —
=== steps: 1. push a photo from pc to sdcard. 2. open gallary to show the photo === what happed / errors 1. the photo is rotated, showing not correctly. but it is showing correctly in pc or android mobile. and it does not work on unagi. === Reason 1. have not read EXIF information when showing photo === Resolution 1. I suggest gaia to read EXIF information. I have test the patch which can resolve this problem. I suggest to merge this patch. please see the attachment(photo/patch)
Attached patch Rotate picture by its orientation metadata (obsolete) (deleted) — Splinter Review
I suggest to merge to master
Attachment #784314 - Flags: review+
Attachment #784314 - Attachment description: mozilla_bug798684.patch → Rotate picture by its orientation metadata
add keven.
David, could yo help to check this out? Thanks!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(dflanagan)
Attachment #784314 - Flags: review?(dflanagan)
Comment on attachment 784314 [details] [diff] [review] Rotate picture by its orientation metadata Review of attachment 784314 [details] [diff] [review]: ----------------------------------------------------------------- I'm giving an r- on this patch for several reasons: 1) The EXIF parsing code is from 2008 and parses the file as a binary string instead of using typed arrays. 2) The Gallery metadata parsing code already has an EXIF parser that uses typed arrays 3) The patch appears to manually rotate images using canvas, and this is bad for three reasons: a) it will take too much memory and time to rotate a full-size image like this in the camera app. b) rotating like this causes a jpeg decode and encode, which reduces the quality of the image c) canvas.toBlob() removes all EXIF information from the resulting JPEG image. 4) The patch does not fix the Gallery app, and the steps to reproduce this bug points out that the gallery should honor the rotation bit.
Attachment #784314 - Flags: review?(dflanagan) → review-
Renfeng: could you please clarify your concern with this bug? Do you only care about images loaded onto the SD card from a PC and viewed in the gallery, or are we trying to support devices where the camera does this kind of "soft rotation" by only setting the EXIF orientation flag? I do not have any such device and would not be able to test a patch. I am also setting needinfo for Tom Herold, who is planning to look at this issue for the Gallery. Tom: I just wanted to bring this bug to your attention. I'm hoping we can fix this in a better way in gallery by reading the EXIF orientation flag during metadata parsing and rotating it as needed. If you can do this by modifying shared/js/media/media_frame.js, then the fix will for Gallery will also fix the filmstrip and pick preview views in the Camera app, if that becomes necessary. (Though in that case, we'd want to move apps/gallery/js/JPEGMetadataParser.js into shared/js/media/ so that Camera can use it too).
Flags: needinfo?(therold)
Flags: needinfo?(renfeng.mei)
Flags: needinfo?(dflanagan)
Blocks: 891030
(In reply to David Flanagan [:djf] from comment #5) > Renfeng: could you please clarify your concern with this bug? Do you only > care about images loaded onto the SD card from a PC and viewed in the > gallery, or are we trying to support devices where the camera does this kind > of "soft rotation" by only setting the EXIF orientation flag? I do not have > any such device and would not be able to test a patch. > > I am also setting needinfo for Tom Herold, who is planning to look at this > issue for the Gallery. Tom: I just wanted to bring this bug to your > attention. I'm hoping we can fix this in a better way in gallery by reading > the EXIF orientation flag during metadata parsing and rotating it as needed. > > > If you can do this by modifying shared/js/media/media_frame.js, then the fix > will for Gallery will also fix the filmstrip and pick preview views in the > Camera app, if that becomes necessary. (Though in that case, we'd want to > move apps/gallery/js/JPEGMetadataParser.js into shared/js/media/ so that > Camera can use it too). David, Hope to be resolved all the picture from whatever pc or camera app. And the patch i commited can resolve the two situation. I agree with your suggestion that move the mataparser to shared directory. Will Tom do this?
Flags: needinfo?(renfeng.mei)
Flags: needinfo?(dflanagan)
(In reply to renfeng.mei from comment #6) > David, > Hope to be resolved all the picture from whatever pc or camera app. Thanks for clarifying that. > And the patch i commited can resolve the two situation. I don't understand: your patch doesn't appear to resolve the situation for a pictured downloaded from a PC and displayed in the gallery. Also, as I noted in my review, it is not acceptable (for performance or memory usage reasons) to manually rotate images in the camera app. If the camera hardware does not do that, we have to modify the code that displays those photographs (in gallery and in the camera) to rotate them with a CSS transform. We need to do this in Gallery anyway, for bug 891030. Tom Herold or I will be working on that bug, and I suspect that the fix there will also fix this bug. > > I agree with your suggestion that move the mataparser to shared directory. > Will Tom do this?
Flags: needinfo?(dflanagan)
(In reply to David Flanagan [:djf] from comment #7) > (In reply to renfeng.mei from comment #6) > > > David, > > Hope to be resolved all the picture from whatever pc or camera app. > > Thanks for clarifying that. > > > And the patch i commited can resolve the two situation. > > I don't understand: your patch doesn't appear to resolve the situation for a > pictured downloaded from a PC and displayed in the gallery. Also, as I > noted in my review, it is not acceptable (for performance or memory usage > reasons) to manually rotate images in the camera app. If the camera > hardware does not do that, we have to modify the code that displays those > photographs (in gallery and in the camera) to rotate them with a CSS > transform. > > We need to do this in Gallery anyway, for bug 891030. Tom Herold or I will > be working on that bug, and I suspect that the fix there will also fix this > bug. > > > > I agree with your suggestion that move the mataparser to shared directory. > > Will Tom do this? Thanks david, I got your point. The patch i supplied is not acceptable (for performance or memory usage reasons).
Assignee: nobody → therold
Flags: needinfo?(therold)
Attached file Link to Pull Request (deleted) —
Attachment #793281 - Flags: review?(dflanagan)
Blocks: 907965
Attachment #793281 - Attachment mime type: text/plain → text/html
Comment on attachment 793281 [details] Link to Pull Request Tom, This looks like good work, but I'm sending it back for changes. I think there are errors in MetadataParser. I recommend that you pass the orientation to the createThumbnailAndPreview() function so that you can create a rotated thumbnail, and also include the orientation object in the returned metadata. Also, I'm not convinced that media_frame.js needs to change as much as you have changed it. Consider handling the rotation earlier in displayImage() or in computeFit() so that width and height get swapped earlier. Does that simplify the calulations and allow you to make fewer changes? If not, please add more comments to the code so I understand why the new container is needed, e.g.
Attachment #793281 - Flags: review?(dflanagan) → review-
Attached image sketch for left/ top translation (deleted) —
Attached image Test image for 180° rotation (deleted) —
Attached image Test image for 270° rotation (deleted) —
Attachment #797455 - Attachment description: Test image for -90° rotation → Test image for 270° rotation
Attachment #797455 - Attachment filename: -90.jpg → 270.jpg
Attachment #793281 - Flags: review- → review?(dflanagan)
Comment on attachment 793281 [details] Link to Pull Request Thanks for the link to the test images. Those are great and really demonstrate that the rotation and mirroring are working right! I'm giving r- because of issues with the metadata parser changes and a couple of formatting nits. See my comments on github. There are a couple of problems with your change where you pass the metadata object to createThumbnailAndPreview(), and I think the easiest thing might be to switch back to the old way of handling it and pass the orientation explicitly when needed.
Attachment #793281 - Flags: review?(dflanagan) → review-
Attachment #793281 - Flags: review- → review?(dflanagan)
Comment on attachment 793281 [details] Link to Pull Request Looks good, Tom. Thanks for your hard work on this.
Attachment #793281 - Flags: review?(dflanagan) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Depends on: 913418
Attachment #784314 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: