https://bugs.kde.org/show_bug.cgi?id=525240
Bug ID: 525240
Summary: Gwenview fails to open RAW/DNG files when their
embedded preview is not in JPEG format
Classification: Applications
Product: gwenview
Version First 26.08.0
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 195800
--> https://bugs.kde.org/attachment.cgi?id=195800&action=edit
[PATCH] lib: decode RAW previews using the correct preview format
DESCRIPTION
Gwenview fails to open DNG files whose embedded preview is not in JPEG format.
Gwenview obtains preview through KDcraw and then sends non-JPEG preview data
into JPEG handling. This logic breaks if the embedded preview is, for instance,
TIFF or PPM-style data.
STEPS TO REPRODUCE
1. In Gwenview, open a DNG/RAW file whose embedded preview is not in JPEG
format (tested preview format: TIFF)
2. Gwenview can not load the image preview
OBSERVED RESULT
UI output:
Gwenview UI shows error: Loading '<filename>.DNG' failed | Loading meta
information failed
stderr output:
org.kde.kdegraphics.gwenview.lib: Not a JPEG file: starts with 0x50 0x36
org.kde.kdegraphics.gwenview.lib: libjpeg fatal error
org.kde.kdegraphics.gwenview.lib: Could not load image with Exiv2, reported
error: "The memory contains data of an unknown image type"
org.kde.kdegraphics.gwenview.lib: Not a JPEG file: starts with 0x50 0x36
org.kde.kdegraphics.gwenview.lib: libjpeg fatal error
EXPECTED RESULT
Gwenview shows the image preview for DNG files whose embedded preview format is
not in JPEG format.
SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.2
ADDITIONAL INFORMATION
The attached patch includes logic for setting proper orientation for embedded
non-JPEG previews. The original RAW preview creates JpegContent for the
extracted preview. JpegContent uses the original RAW file's Exiv2 metadata to
account for EXIF orientation and to transpose the reported image size for
rotated images. Non-JPEG previews can't go through JpegContent. Therefore, the
patch carries the orientation behavior over for the QImageReader without
overriding transformations already handled by the image decoder.
Alternative patch file (gwenview-dng-preview-non-jpeg.norotate.patch, link
below) does not include the orientation correction logic. The alternative patch
file is available at:
https://fjordtek.com/pool/other/patches/gwenview-26.08.0/gwenview-dng-preview-non-jpeg.norotate.patch
For behavior test, I provide two ~44MB test files which are available at:
- https://fjordtek.com/pool/other/img/test_horizontal.DNG
- https://fjordtek.com/pool/other/img/test_vertical.DNG
Gwenview image preview fails on both files without the attached patch applied.
With 'norotate' version of the patch, test_vertical.DNG orientation is also
incorrect.
Useful commands for preview image inspection:
exiv2 -pp <filename>.DNG
exiv2 -ep <filename>.DNG
file <filename>-preview.tif
tiffinfo <filename>-preview.tif
exiftool -G1 -s <filename>-preview.tif
Disclaimer: I saw the Bugzilla message which informs not to upload patches
here. However, due to complexity of creating merge request on KDE GitLab, I did
not upload the patch in the form of a merge request there. I still feel the
patch is important enough, especially for folks who are affected the same DNG
preview bug issue. Feel free to submit/adapt the patch to the upstream code
base. Thank you.
--
You are receiving this mail because:
You are watching all bug changes.