kevva / to-ico

Convert PNG to ICO in memory
MIT License
137 stars 19 forks source link

The `icotool -l` command returns "incorrect total size of bitmap" for files produced by this library #17

Closed ezzatron closed 2 months ago

ezzatron commented 6 years ago

I was doing some double-checking on the ICO files produced by to-ico. When you use icoutils to list the contents of an ICO file produced by to-ico, you will get something similar to this output:

$ icotool -l path/to/to-ico.ico
path/to/to-ico.ico: incorrect total size of bitmap (1064 specified; 1128 real)

Whereas an ICO file produced by some other tool produces this output:

$ icotool -l path/to/other.ico
--icon --index=1 --width=48 --height=48 --bit-depth=32 --palette-size=0
--icon --index=2 --width=32 --height=32 --bit-depth=32 --palette-size=0
--icon --index=3 --width=16 --height=16 --bit-depth=32 --palette-size=0

It doesn't seem to change based upon how many, or which, icon sizes I provide to to-ico. Is there a bug in how you're calculating, or encoding, output size values?

ezzatron commented 6 years ago

I just found this related issue: https://github.com/scriptPilot/app-framework/issues/333

And sure enough, ImageMagick has no problem with the file:

$ magick identify path/to/to-ico.ico
path/to/to-ico.ico [0] ICO 16x16 16x16+0+0 8-bit sRGB 14510B 0.000u 0:00.000
path/to/to-ico.ico [1] ICO 32x32 32x32+0+0 8-bit sRGB 14510B 0.000u 0:00.000
path/to/to-ico.ico [2] ICO 48x48 48x48+0+0 8-bit sRGB 14510B 0.000u 0:00.000

🤷‍♂️