Bug 307080

Summary: PNG image in CBZ wrapper does not display correctly (but PNG itself does)
Product: [Applications] okular Reporter: Cory F Cohen <cfcohen77>
Component: Comicbook backendAssignee: Okular developers <okular-devel>
Status: RESOLVED WORKSFORME    
Severity: normal CC: aacid, gaetan.gilbert, luigi.toscano
Priority: NOR    
Version: 0.14.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The CBZ version of the file that exhibits the problem.
The PNG version of the same file that does NOT exhibit the problem.
A nearly identical CBZ that generates some errors, but still displays.

Description Cory F Cohen 2012-09-20 02:17:11 UTC
This bug report is probably exposing some inconsistency in the library used to render images between the comic book backend and the default image handling library.  I would expect the problem to be upstream somewhere, but I have no idea where. A number of messages such as these are printed to stderr:

QIODevice::read: Called with maxSize < 0
QIODevice::seek: Invalid pos: -6
QImage::scaled: Image is a null image

I'll try to attach a demonstration file if I can figure out where to upload it to the bug report.

Reproducible: Always

Steps to Reproduce:
I also suspect that the problem is also related to handling of 1-bit deep PNG images (which have historically had problems in a number of applications that otherwise support PNG images).  The characteristics of the image are:

$ gm identify -verbose okular-test.png 
Image: okular-test.png
  Format: PNG (Portable Network Graphics)
  Geometry: 2722x3776
  Class: PseudoClass
  Type: bilevel
  Depth: 1 bits-per-pixel component
  Channel Depths:
    Gray:     1 bits
  Channel Statistics:
    Gray:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                      251.17 (0.9850)
      Standard Deviation:         31.02 (0.1216)
  Colors: 2
    0: (  0,  0,  0)      black
    1: (255,255,255)      white
  Resolution: 72x72 pixels
  Filesize: 38.2K
  Interlace: No
  Orientation: Unknown
  Background Color: black
  Border Color: #DFDFDF
  Matte Color: #BDBDBD
  Compose: Over
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Comment:  generated by unpaper

  Create-date: 2008-04-02T20:07:08-04:00
  Modify-date: 2008-04-02T20:07:08-04:00
  Signature: ba1078561438738723d855335e97b5f0745cb53153d9f75697b06ae5c2fd6dee
  Tainted: False
  User Time: 0.070u
  Elapsed Time: 0:01
  Pixels Per Second: 326.7M

Actual Results:  
The page just display with the Okular icon.

Expected Results:  
The actual image.
Comment 1 Cory F Cohen 2012-09-20 02:20:43 UTC
Created attachment 74039 [details]
The CBZ version of the file that exhibits the problem.
Comment 2 Cory F Cohen 2012-09-20 02:21:48 UTC
Created attachment 74040 [details]
The PNG version of the same file that does NOT exhibit the problem.
Comment 3 Cory F Cohen 2012-09-20 02:23:48 UTC
Created attachment 74041 [details]
A nearly identical CBZ that generates some errors, but still displays.

I also should have mentioned that the problem exhibits for some files, and not for others.  This is an example of a similarly encoded PNG file that works just fine when enclosed in a CBZ wrapper.
Comment 4 Albert Astals Cid 2012-09-20 07:13:23 UTC
Hi Cory, thanks for the report, I've opened attachment from comment one using Okular 0.15.1 and kdelibs 4.9.1 and it works fine (the page gets shown correctly) so I'm closing this bug as worksforme. If you can update to Okular 0.15.1 and kdelibs 4.9.1 in the future and you still have this problem please reopen this bug.

Thanks for caring about Okular and reporting this bug :-)
Comment 5 Cory F Cohen 2012-09-21 03:29:30 UTC
Thanks, I've upgraded to KDE 4.9.1 (Okular 0.15.1) using the repository at ppa:kubuntu-ppa/backports, and I can confirm that the bug is fixed for me as well.  I've found a number of other bugs in various KDE apps before the upgrade and want to be running the latest version before reporting any more of them.  Is the kubuntu backports ppa relatively stable or is truly bleeding edge?
Comment 6 Albert Astals Cid 2012-09-21 14:08:22 UTC
Sorry, can't really answer about the stability of kubuntu ppas or not
Comment 7 Gaëtan Gilbert 2021-04-23 09:05:13 UTC
Does not work for me with okular 20.12.3 (debian testing, KDE frameworks 5.78.0, Qt 5.15.2, libpng 1.6.37-3)

Both attached cbz display the okular icon and output on stderr:

libpng warning: zTXt: CRC error
libpng error: PNG unsigned integer out of range
QImage::scaled: Image is a null image
libpng warning: zTXt: CRC error
libpng error: PNG unsigned integer out of range
QImage::scaled: Image is a null image
libpng warning: zTXt: CRC error
libpng error: PNG unsigned integer out of range
QImage::scaled: Image is a null image
libpng warning: zTXt: CRC error
libpng error: PNG unsigned integer out of range
QImage::scaled: Image is a null image

(the same thing for both files, on files without buggy images nothing is printed)

Opening the images directly without the cbz wrapper works fine.
Comment 8 Luigi Toscano 2021-04-23 09:11:09 UTC
As the error message is different  than the old one, and the old bug is related to a totally different version of the underlying software stack, please keep this closed and open a new bug.
Comment 9 Gaëtan Gilbert 2021-04-23 09:19:36 UTC
OK, here's https://bugs.kde.org/show_bug.cgi?id=436086