Fix orientation when saving/transforming JPEG images
ClosedPublic

Authored by muhlenpfordt on Sep 12 2018, 3:14 PM.

Details

Summary

6597d3f35196 introduced lossless JPEG transformations including a
reset of the Exif orientation tag before saving a JPEG image.
This leads to wrongly transformed images (modified or unmodified)
if the original JPEG already had an orientation tag with a visible
transformation (not None or Normal).
This is fixed by not resetting the orientation before saving, which
keeps the original JPEG data including orientation. Only before
executing a lossless transformation the Exif orientation correction
is applied and the tag is reset.

FIXED-IN: 18.08.2

Test Plan
  • Open JPEG image with Exif orientation other than None/Normal
  • Optional: Rotate/Mirror image
  • FileSave or FileSave As
  • Restart Gwenview to clear image cache
  • The new image should have the correct orientation

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
muhlenpfordt created this revision.Sep 12 2018, 3:14 PM
Restricted Application added a project: Gwenview. · View Herald TranscriptSep 12 2018, 3:14 PM
muhlenpfordt requested review of this revision.Sep 12 2018, 3:14 PM

I noticed this bug report but can't confirm a change in JPEG quality or file size when saving (as the original reporter stated).
ATM the transformation is not done by just changing the Exif orientation as Christoph suggested, but by lossless data transformation.
So I think this patch does not really fix that bug.

Ah, sorry - did not read your question correctly.
I can't confirm any of these bugs with current Gwenview versions - maybe the first one was fixed by this commit but the second is not for JPG files.
Besides the commit is older than both bug reports.

Added comment and grouping

If there are no objections I'll commit this at end of the week.

ngraham accepted this revision.Sep 18 2018, 1:57 PM
ngraham added a subscriber: rkflx.

Sorry for the extended review time. It's just not the same since @rkflx left :(

This revision is now accepted and ready to land.Sep 18 2018, 1:57 PM
This revision was automatically updated to reflect the committed changes.