google / guetzli

Perceptual JPEG encoder
Apache License 2.0
12.9k stars 976 forks source link

Failed to generate from large png file #94

Closed boxcounter closed 7 years ago

boxcounter commented 7 years ago
╭─Boxcounter  ~
╰─$ file ./tmp.png                                                                                                                                                                                                                      1 ↵
./tmp.png: PNG image data, 7328 x 80222, 8-bit/color RGB, non-interlaced
╭─Boxcounter  ~
╰─$ guetzli --verbose ./tmp.png tmp2.jpg
Could not create jpg data from rgb pixels
Guetzli processing failed

you can download the attachments and unzip 1.zip && unzip 2.zip && unzip 3.zip && cat 1 2 3 > tmp.png to retrieve the png image.

1.zip 2.zip 3.zip

robryk commented 7 years ago

The file you've provided appears not to be a valid PNG. It also appears to crash ImageMagick's display (possibly due to its gargantuan size):

$ unzip 1.zip 
Archive:  1.zip
  inflating: 1                       
$ unzip 2.zip                                                                                                                                                                                                                                                                                      
Archive:  2.zip
  inflating: 2                       
$ unzip 3.zip                                                                                                                                                                                                                                                                                      
Archive:  3.zip
  inflating: 3                       
$ cat 1 2 3 > foo.png
$ identify foo.png
foo.png PNG 7328x80222 7328x80222+0+0 8-bit DirectClass 34.92MB 0.000u 0:00.000
$ feh foo.png 
libpng error: IDAT: CRC error
libpng error: IDAT: CRC error
libpng error: IDAT: CRC error
$ display foo.png 
XIO:  fatal IO error 14 (Bad address) on X server ":0"
      after 13595 requests (3562 known processed) with 20 events remaining.
$ sha256sum foo.png 
68076fc8dbb15e18b4b533643a6cbf106393b90b699d92e38a68798f0ea795fe  foo.png

Please verify that the checksum matches (to make sure that no errors were introduced due to the way the file was transferred).

Do you believe the file to be a valid PNG? If so, why?

robryk commented 7 years ago

Also, note that this image is humongous. At 584MPix, current version of Guetzli will require a bit less than 175GB of memory to handle it.

boxcounter commented 7 years ago

The sha256sum result is correct. I viewed the png in Preview and Xee app on macOS Sierra 10.12.3. And yes, it's a humongous image :P

Thanks for the memory usage information. You can close this issue.

robryk commented 7 years ago

For the record, I believe libpng thinks it's an invalid image due to incorrect CRCs. Current version of Guetzli would anyway be unbearably memory-heavy and time-consuming on it.