<table><tr><td style="">trufanov edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-xc4puagulbxc7gd/" rel="noreferrer">(Show Details)</a>
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D8415" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">resolves bug https://bugs.kde.org/show_bug.cgi?id=385384<br />
<br />
Bug 385384 - Some PNG files produced by acdsee can't be displayed<br />
<br />
> Hi,<br />
> 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.<br />
> <br />
> 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.<br />
> <br />
> This allowed me to workaround problem in my app.<br />
> <br />
> Gwenviews code: <br />
> They log an error [[ https://github.com/KDE/gwenview/blob/1259680d9295bf4d36f481d9a2002639738ff00d/lib/document/loadingdocumentimpl.cpp#L317 | here ]] but as loadImageData() is a void function and mImage still contains valid image the app displays it as usual.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">BUG 385384</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">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</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Some applications (like acdsee v3.1) produce PNG files that can't be opened in Okular while gwenview, GIMP and ImageMagick is able to display them. For such files QImageReader returns false as a result of open operation while resulting QImage still gets a valid data. This patch soften image file open checks. Now file open error is not reported if resulting QImage is valid even if read function returned false</span>.<br />
<br />
A test png is attached.<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">I was told that this was a tiff file (result of scanning) that was converted to png with acdsee v3.1 under Win.<br />
<br />
</span>[[ https://bugs.kde.org/attachment.cgi?id=108176 | Attachment ]]<br />
<br />
</div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8415" rel="noreferrer">https://phabricator.kde.org/D8415</a></div></div><br /><div><strong>To: </strong>trufanov, ngraham, Okular<br /><strong>Cc: </strong>aacid<br /></div>