ImageMagick can't open some PNG files, mostly 1-bit grayscale stuff
Posted: 2015-03-14T08:11:51-07:00
Example image:
Trying to read/convert this with imagemagick fails, eg.
As you can see, the resulting PPM file is completely blank. Converting it to JPEG or another format does not help, nor does converting it to another PNG. Furthermore, trying to use applications like zbarimg, which rely on ImageMagick to read files, fails (it also reads completely blank images).
For comparison, the tool pngtopnm works fine here:
And converting this resulting PPM file to a PNG or JPEG again using ImageMagick also works. Therefore, I suspect that the issue is in the PNG decoder.
Trying to read/convert this with imagemagick fails, eg.
Code: Select all
$ wget https://i.imgur.com/WyBCPty.png
...
$ convert WyBCPty.png test.ppm
$ hexdump -C test.ppm
00000000 50 36 0a 38 37 20 38 37 0a 32 35 35 0a 00 00 00 |P6.87 87.255....|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000058c0
For comparison, the tool pngtopnm works fine here:
Code: Select all
$ pngtopnm WyBCPty.png > test.ppm
$ hexdump -C test.ppm | head
00000000 50 34 0a 38 37 20 38 37 0a 00 00 00 00 00 00 00 |P4.87 87........|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0f ff |................|
00000090 ff 81 c7 e3 ff ff e0 00 00 0f ff ff 81 c7 e3 ff |................|
000000a0 ff e0 00 00 0f ff ff 81 c7 e3 ff ff e0 00 00 0e |................|
000000b0 00 03 81 ff 03 80 00 e0 00 00 0e 00 03 81 ff 03 |................|
000000c0 80 00 e0 00 00 0e 00 03 81 ff 03 80 00 e0 00 00 |................|
000000d0 0e 3f e3 8f c7 e3 8f f8 e0 00 00 0e 3f e3 8f c7 |.?..........?...|
000000e0 e3 8f f8 e0 00 00 0e 3f e3 8f c7 e3 8f f8 e0 00 |.......?........|
$
Code: Select all
$ convert --version
Version: ImageMagick 6.9.0-3 Q64 x86_64 2015-02-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
Features: DPC HDRI Modules OpenCL
Delegates (built-in): bzlib cairo fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff webp x xml zlib
$ eix -I imagemagick
[I] media-gfx/imagemagick
Available versions: 6.9.0.3(0/6.9.0.3)^u {X autotrace bzip2 corefonts cxx djvu fftw fontconfig fpx graphviz hdri jbig jpeg jpeg2k lcms lqr lzma opencl openexr openmp pango perl png postscript q32 q64 q8 raw static-libs svg test tiff truetype webp wmf xml zlib}
Installed versions: 6.9.0.3^u(10:37:06 2015-02-14)(X bzip2 cxx fontconfig hdri jbig jpeg jpeg2k lcms lqr lzma opencl openexr openmp pango perl png q64 raw svg tiff truetype webp xml zlib -autotrace -corefonts -djvu -fftw -fpx -graphviz -postscript -q32 -q8 -static-libs -test -wmf)
Homepage: http://www.imagemagick.org/
Description: A collection of tools and libraries for many image formats