ImageMagick 6.6.3 converting windows .ico files broken

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
Rosch
Posts: 4
Joined: 2010-07-15T01:29:44-07:00
Authentication code: 8675308

ImageMagick 6.6.3 converting windows .ico files broken

Post by Rosch »

Hi....

I recently updated to imagemagick 6.6.3 (from 6.4.8 ) and now found that converting windows icon files
seem to be broken. I tried my self compiled linux version on OpenSuse 11.2 and also your precompiled windows portable versions.

I get the following error messages when using your portable windows binaries.
$ ./convert.exe test.ico -quality 100 test.jpg
convert.exe: Empty JPEG image (DNL not supported) `test.jpg' @ error/jpeg.c/EmitMessage/235.

$ ./convert.exe test.ico -quality 100 test.png
convert.exe: Image height is zero in IHDR `test.png' @ warning/png.c/PNGWarningHandler/1457.
convert.exe: Invalid IHDR data `test.png' @ error/png.c/PNGErrorHandler/1437.

I get the same errors on linux and with ImageMagick 6.6.1. It work with 6.4.8.
I uploaded the ico that produces the error (I got the error with about 30 different icos. Here is one of them).
http://qdrive.net/Rosch/file/147833/a25 ... 71b20d5e96

Thanks for your Help,

Roland
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick 6.6.3 converting windows .ico files broken

Post by snibgo »

On Windows 7, using the linked ico file:

convert test.ico test.png
convert test.ico test.jpg

works for IM version 6.5.8-8 but fails in the stated way for 6.6.1-1.
snibgo's IM pages: im.snibgo.com
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: ImageMagick 6.6.3 converting windows .ico files broken

Post by Drarakel »

Seems that the image properties of this ICO get identified falsely in the current IM versions:
Geometry: 128x0+0+0
Rosch
Posts: 4
Joined: 2010-07-15T01:29:44-07:00
Authentication code: 8675308

Re: ImageMagick 6.6.3 converting windows .ico files broken

Post by Rosch »

Any clue if and when this will be fixed?

Thanks in advance,

Roland
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: ImageMagick 6.6.3 converting windows .ico files broken

Post by Drarakel »

More details:
The bug came with version 6.6.0-1. Probably with this change:
Check to see if ICON image width /height exceeds that of the image canvas.
Before that version, IM basically only read the width and height value of the ICO header (the canvas), I guess. With version 6.6.0-1 or newer, the width and height values in the Bitmapinfoheader sections of the images within the ICO are used, too. But it seems that ImageMagick only reads the low byte (little endian) there - at least for the image properties. That results in the effect that ICOs with more than 127 rows can't get read properly anymore - as the height value in the Bitmapinfoheader is a doubled value. So, at least two bytes must be read there.
Example:

Code: Select all

convert logo: -resize x190 ICO:- | convert -verbose ICO:- icon.png
ICO:-=>- ICO 253x62 253x62+0+0 8-bit DirectClass 198KB 0.000u 0:00.000
ICO:-=>icon.png ICO 253x62 253x62+0+0 8-bit DirectClass 0.016u 0:00.046
The height 190 gets stored as 0x7C010000 (=380=2x190). But IM reads only 0x7C, so it thinks the height in this image is 124/2=62 and reads only the lower 62 rows.
icon.png:
Image
And when the real height of an ICO image is 128, the mentioned value is 0x00010000, so IM thinks the height is 0.
Post Reply