trufanov created this revision.
trufanov added reviewers: ngraham, Okular.
trufanov added a project: Okular.

REVISION SUMMARY
  resolves bug https://bugs.kde.org/show_bug.cgi?id=385384
  
  Bug 385384 - Some PNG files produced by acdsee can't be displayed
  
  > 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: 
  >  They log an 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.
  
  Attachment <https://bugs.kde.org/attachment.cgi?id=108176>

TEST PLAN
  Try to open attached png file. It can't be opened.
  Apply patch (make sure Okular uses fixed okularGenerator_kimgio.so) - now it 
could be opened and displayed correctly.

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D8415

AFFECTED FILES
  generators/kimgio/generator_kimgio.cpp

To: trufanov, ngraham, #okular
Cc: aacid

Reply via email to