<table><tr><td style="">trufanov created this revision.<br />trufanov added reviewers: ngraham, Okular.<br />trufanov added a project: Okular.
</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>REVISION SUMMARY</strong><div><p>resolves bug <a href="https://bugs.kde.org/show_bug.cgi?id=385384" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=385384</a></p>

<p>Bug 385384 - Some PNG files produced by acdsee can't be displayed</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>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.</p>

<p>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 <tt style="background: #ebebeb; font-size: 13px;">void QImage::load(...)</tt> or <tt style="background: #ebebeb; font-size: 13px;">QImage QImageReader::read()</tt> it invokes <tt style="background: #ebebeb; font-size: 13px;">bool QImageReader::read(QImage *)</tt>. And it ignores its result value if returned QImage is valid.</p>

<p>This allowed me to workaround problem in my app.</p>

<p>Gwenviews code: <br />
 They log an error <a href="https://github.com/KDE/gwenview/blob/1259680d9295bf4d36f481d9a2002639738ff00d/lib/document/loadingdocumentimpl.cpp#L317" class="remarkup-link" target="_blank" rel="noreferrer">here</a> but as loadImageData() is a void function and mImage still contains valid image the app displays it as usual.</p></blockquote>

<p>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.</p>

<p>A test png is attached.<br />
I was told that this was a tiff file (result of scanning) that was converted to png with acdsee v3.1 under Win.</p>

<p><a href="https://bugs.kde.org/attachment.cgi?id=108176" class="remarkup-link" target="_blank" rel="noreferrer">Attachment</a></p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Try to open attached png file. It can't be opened.<br />
Apply patch (make sure Okular uses fixed okularGenerator_kimgio.so) - now it could be opened and displayed correctly.</p></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>AFFECTED FILES</strong><div><div>generators/kimgio/generator_kimgio.cpp</div></div></div><br /><div><strong>To: </strong>trufanov, ngraham, Okular<br /><strong>Cc: </strong>aacid<br /></div>