Wrong color depth reported for PNG-compressed icons

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
eyebex
Posts: 10
Joined: 2012-06-16T12:33:28-07:00
Authentication code: 13

Wrong color depth reported for PNG-compressed icons

Post by eyebex »

Hi,

if I run

$ identify.exe git.ico
git.ico[0] ICO 16x16 16x16+0+0 32-bit DirectClass 48.3KB 0.016u 0:00.015
git.ico[1] ICO 24x24 24x24+0+0 32-bit DirectClass 48.3KB 0.016u 0:00.015
git.ico[2] ICO 32x32 32x32+0+0 32-bit DirectClass 48.3KB 0.016u 0:00.015
git.ico[3] ICO 48x48 48x48+0+0 32-bit DirectClass 48.3KB 0.016u 0:00.015
git.ico[4] ICO 64x64 64x64+0+0 32-bit DirectClass 48.3KB 0.016u 0:00.031
git.ico[1] ICO 256x256 256x256+0+0 8-bit DirectClass 48.3KB 0.016u 0:00.031

you can see that for the last image (which is the only one that is PNG compressed) a color depth of "8-bit" is reported, although it should be "32-bit" IMHO. Moreover, I believe the number in the square brackets should also be "5" instead of "1", or?

Get the test icon, which was exported from Gimp 2.8, at http://threekings.tk/tmp/git.ico
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Wrong color depth reported for PNG-compressed icons

Post by glennrp »

"identify -verbose git.ico" gives more information. It reports "depth: 32/8"
which I suppose means pixel depth 32, sample depth 8. It also reports an
incorrect rendering_intent (53), and reports the presence of gAMA, cHRM,
and sRGB chunks which I can't find in the git.ico file.

Here's an extract from "od -c git.ico" which shows that there are no
such chunks, only IHDR, IDAT, and IEND:
  • ...
    0105500 037 377 377 377 377 377 377 374 ? 377 377 377 211 P N G
    0105520 \r \n 032 \n \0 \0 \0 \r I H D R \0 \0 001 \0
    0105540 \0 \0 001 \0 \b 006 \0 \0 \0 \ r 250 f \0 \0
    0105560 \0 I D A T x 234 355 235 y w S W 232 365 177
    0105600 266 345 021 333 030 \b 363 230 004 310 \0 ! c U W 367
    ...
    0140400 031 324 = 361 223 353 _ l 374 177 024 304 244 A 360 177
    0140420 \b 341 \0 \0 \0 \0 I E N D 256 B ` 202
    0140436
eyebex
Posts: 10
Joined: 2012-06-16T12:33:28-07:00
Authentication code: 13

Re: Wrong color depth reported for PNG-compressed icons

Post by eyebex »

While the incorrect reports of the rendering_intent and chunks seem to be fixed in IM 6.8.4, the reported depth for the PNG icon still is 8-bit instead of 32-bit. Even if "identify" reports the sample depth, shouldn't it report the pixel depth instead anyway?
Post Reply