Bug 385384 - Some PNG files produced by acdsee can't be displayed
Summary: Some PNG files produced by acdsee can't be displayed
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.2.70
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-05 06:10 UTC by Alexander Trufanov
Modified: 2017-11-14 13:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
test png image (2.54 MB, image/png)
2017-10-05 06:10 UTC, Alexander Trufanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Trufanov 2017-10-05 06:10:18 UTC
Created attachment 108176 [details]
test png image

Hi,
I've got a png file that could be opened in gwenview, GIMP and ImageMagick. But can't be viewed in Okular. My app had the same problem so I dig into gwenview sourcecode to find the solution and now would like to share my findings.

As gwenview my app uses Qt's QImage/QImageReader to load this png file. And Qt uses libpng1.6.28-1 that prints in std::cout "libpng error: Read Error" in both cases. But gwenview ignores this error and still able to show image. Bcs instead of `void QImage::load(...)` or `QImage QImageReader::read()` it invokes `bool QImageReader::read(QImage *)`. And it ignores its result value if returned QImage is valid.

This allowed me to workaround problem in my app.

Gwenviews code: 
The log error [here](https://github.com/KDE/gwenview/blob/1259680d9295bf4d36f481d9a2002639738ff00d/lib/document/loadingdocumentimpl.cpp#L317) but as loadImageData() is a void function and mImage still contains valid image the app displays it as usual.

My assumption is that png has incomplete or incorrect set of flags in header so libpng reports error while still loads image data to RAM.

A test png is attached.
I was told that this was a tiff file (result of scanning) that was converted to png with acdsee v3.1 under Win.
Comment 1 Nate Graham 2017-10-12 04:53:26 UTC
Thanks for the bug and the investigation. Please feel free to submit a patch on http://phabricator.kde.org/!
Comment 2 Alexander Trufanov 2017-11-07 17:57:45 UTC
The workaround is proposed on https://phabricator.kde.org/D8415