Problems with convert on specific PNG file.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
findus
Posts: 14
Joined: 2012-08-14T07:57:42-07:00
Authentication code: 67789

Problems with convert on specific PNG file.

Post by findus »

I am trying to convert a PNG file with the following command:

Code: Select all

convert problematic.png test.jpg
My version is: (Output of "convert --version")

Code: Select all

Version: ImageMagick 6.8.8-5 Q16 x64 2014-02-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
The conversion fails with the following output:

Code: Select all

convert.exe: bad adaptive filter value `problematic.png' @ error/png.c/MagickPNGErrorHandler/1804.
convert.exe: Corrupt image `problematic.png' @ error/png.c/ReadPNGImage/4069.
convert.exe: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3147.
I can open the file with a bunch of other programs (GIMP, IrfanView, MS Paint). The file can be downloaded here: https://dl.dropboxusercontent.com/u/372 ... ematic.png
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problems with convert on specific PNG file.

Post by snibgo »

Your link doesn't work.
snibgo's IM pages: im.snibgo.com
findus
Posts: 14
Joined: 2012-08-14T07:57:42-07:00
Authentication code: 67789

Re: Problems with convert on specific PNG file.

Post by findus »

Works fine for me, and for a friend with another dropbox account.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problems with convert on specific PNG file.

Post by fmw42 »

snibgo wrote:Your link doesn't work.
The image is very tiny in the upper left corner. Easy to miss.

I think your PNG file is either corrupt or malformed.

I get this message


convert problematic.png test.jpg
convert: bad adaptive filter value `problematic.png' @ error/png.c/MagickPNGErrorHandler/1804.
convert: corrupt image `problematic.png' @ error/png.c/ReadPNGImage/4069.
convert: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3147.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problems with convert on specific PNG file.

Post by snibgo »

Ahh, I've found it. My usual browser (Firefox) doesn't show the picture, but instead shows the filename. But MS Internet Explorer does show an image.

I suppose Firefox hits the same problem as ImageMagick. Yes, the file seems to be corrupt. Another utility reports:

Code: Select all

F:\web\im>dumppng /iproblematic.png
      Input: /i problematic.png
WARNING(libpng): Ignoring bad adaptive filter type -
WARNING(libpng): Ignoring bad adaptive filter type -
WARNING(libpng): Ignoring bad adaptive filter type -
WARNING(libpng): Ignoring bad adaptive filter type -
WARNING(libpng): Ignoring bad adaptive filter type -
WARNING(libpng): Ignoring bad adaptive filter type -
ERROR(libpng): incorrect data check -
dimensions not found
However, Gimp can read it, and export it to another png file, which IM is happy with.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Problems with convert on specific PNG file.

Post by glennrp »

I tried to download it using Firefox but it rejected it. I was able to get it using Chrome though.

pngcrush -n -v problematic.png says
Reading IHDR chunk, length = 13.
Reading gAMA chunk, length = 4.
Reading tEXt chunk, length = 25.
Reading IDAT chunk, length = 396.
libpng warning: [00][00][00][00]: CRC error
Reading IEND chunk, length = 0.

and pngcheck -v says something similar.
findus
Posts: 14
Joined: 2012-08-14T07:57:42-07:00
Authentication code: 67789

Re: Problems with convert on specific PNG file.

Post by findus »

Does this mean that this will not be fixed?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Problems with convert on specific PNG file.

Post by glennrp »

findus wrote:Does this mean that this will not be fixed?
It's your PNG file that is corrupt, so that's up to you, not us.
findus
Posts: 14
Joined: 2012-08-14T07:57:42-07:00
Authentication code: 67789

Re: Problems with convert on specific PNG file.

Post by findus »

As I mentioned in my initial post, the file can be opened by other programs just fine.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Problems with convert on specific PNG file.

Post by glennrp »

findus wrote:As I mentioned in my initial post, the file can be opened by other programs just fine.
I can open it with a revised version of pngcrush, but it just looks like a 10x15 mess of randomly colored pixels.
I can revise png.c to work like pngcrush in that respect, but would rather not have that be the default behavior.
Note that not only the bad CRC handling has to be defeated, but the handling of invalid filter bytes and a zlib
"data error" as well, to read this image.
Post Reply