Bug 410778

Summary: Okular does not respect EXIF orientation tag inside comicbook archives
Product: [Applications] okular Reporter: 2wxsy58236r3
Component: Comicbook backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 20.04.0
Sentry Crash Report:
Attachments: Test files (Smaller file size)

Description 2wxsy58236r3 2019-08-10 04:50:16 UTC
SUMMARY
Okular does not respect EXIF orientation tag of JPG files, displaying the images in wrong orientation.

STEPS TO REPRODUCE
1. Take some photos, but in a wrong orientation.
2. View the files using Gwenview. The photos need to be rotated.
3. Use exiftran to fix the orientation.
4. View the resulting files using Gwenview. The photos are now displayed properly because Gwenview respects EXIF orientation tag.
5. Rename the files to 001.jpg, 002.jpg, etc. and compress them into a ZIP archive.
6. Rename the archive to .cbz so that Okular can open it using the Comicbook backend.
7. View the file using Okular.

OBSERVED RESULT
Okular does not rotate the photos according to the EXIF orientation tag.

EXPECTED RESULT
Okular rotates the photos automatically according to the EXIF orientation tag.
Comment 1 Albert Astals Cid 2020-02-27 15:03:48 UTC
Please attach some files to reproduce this issue
Comment 2 2wxsy58236r3 2020-03-01 09:07:21 UTC
The test files are too big so please download them using the below link:
https://send.firefox.com/download/f8faa5678c25aad9/#vIFG3oZUTaED9mRXCs925Q

Also please refer to the updated steps to reproduce below:

1. A photo is taken in a wrong orientation.
2. Use exiftool (e.g. `exiftool -orientation=3 -n test.jpg`) to tag the correct orientation.
3. Observe that Gwenview displays test.jpg correctly.
4. Compress test.jpg into a ZIP archive and then rename it to .cbz.
5. Open test.cbz using Okular and observe that the image is displayed in the wrong orientation.
Comment 3 Albert Astals Cid 2020-03-01 10:25:36 UTC
Ah you mean inside comicbook archives, if you open file.jpg it'll be shown correctly.
Comment 4 Albert Astals Cid 2020-03-01 10:45:31 UTC
Are you ok if i use that image for an autotest so that it won't break again?
Comment 5 2wxsy58236r3 2020-03-01 12:17:28 UTC
Created attachment 126518 [details]
Test files (Smaller file size)

I am attaching a new set of test files with a smaller file size - I hope these will be suitable for autotests.
Comment 6 Albert Astals Cid 2020-03-04 19:41:38 UTC
Git commit 4019ec56e57624137ff11bb86920894a4fdd80d3 by Albert Astals Cid.
Committed on 04/03/2020 at 19:07.
Pushed by aacid into branch 'master'.

comicbook: Obey autotransform of images

M  +15   -6    generators/comicbook/CMakeLists.txt
A  +61   -0    generators/comicbook/autotests/comicbooktest.cpp     [License: GPL (v2+)]
A  +-    --    generators/comicbook/autotests/data/rotated_cb.cbz
M  +11   -2    generators/comicbook/document.cpp
M  +0    -2    generators/comicbook/generator_comicbook.cpp

https://invent.kde.org/kde/okular/commit/4019ec56e57624137ff11bb86920894a4fdd80d3