Ico File Extension Issues

Hello,

I tried out Pro Motion NG’s .ico file format and ran into problems with the result. I’m using version 8.0.10 on Windows 10.

forIcoTest10x

This is a png of a test image 9x7 with a 10x upscale.

As far as I know, ico files follow similar restrictions as cur and ani files – they’re supposed to be powers of 2. Pro Motion NG doesn’t notify that there’s a problem with irregular sizes. And, it’s a bit easier to see the problem when the size is irregular. Sometimes a properly sized file would appear correctly in one graphics program but not load in another.

asItAppearsInGimp

This is what the icon looks like when imported into GIMP (the two alternating gray pixels are from the background checker, the pixels are transparent). Aseprite opens an empty image with all clear black pixels. Irfanview shows a decode error. XnViewMP opens a result similar to GIMP.

Row 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 00 00 01 00 01 00 09 07 00 00 01 00 20 00 F8 01
00000010 00 00 16 00 00 00 28 00 00 00 09 00 00 00 0E 00
00000020 00 00 01 00 20 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FD
00000040 FF FF 16 DB 96 FF 2F B5 37 FF 5B 95 00 FF 88 78
00000050 00 FF A1 49 29 FF 92 24 49 FF 82 0B 71 FF 82 0B
00000060 71 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 DD
00000070 FF FF 03 F8 E9 FF 1D D2 7B FF 32 AC 14 FF 62 8C
00000080 00 FF 98 6D 00 FF FF FF FF 00 91 1E 53 FF 82 0B
00000090 71 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 BE
000000A0 FF FF 00 E7 FF FF 09 EE CE FF 25 C8 66 FF 41 A4
000000B0 00 FF FF FF FF 00 FF FF FF 00 FF FF FF 00 91 1E
000000C0 53 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 A1
000000D0 FF FF 00 C8 FF FF FF FF FF 00 10 E5 B2 FF 2B BF
000000E0 4F FF 50 9D 00 FF FF FF FF 00 A4 53 1D FF 92 24
000000F0 49 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 7C
00000100 FF FF FF FF FF 00 FF FF FF 00 FF FF FF 00 16 DB
00000110 96 FF 2F B5 37 FF 5B 95 00 FF 88 78 00 FF A1 49
00000120 29 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 53
00000130 FF FF 00 88 FF FF FF FF FF 00 00 DD FF FF 03 F8
00000140 E9 FF 1D D2 7B FF 32 AC 14 FF 62 8C 00 FF 98 6D
00000150 00 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00000160 FF FF 00 62 FF FF 00 95 FF FF 00 BE FF FF 00 E7
00000170 FF FF 09 EE CE FF 25 C8 66 FF 41 A4 00 FF 62 8C
00000180 00 FF 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00000190 FF FF 02 00 FF FF 07 00 FF FF 22 00 FF FF 70 00
000001A0 FF FF 20 00 FF FF 00 00 FF FF

This is a hex dump of the file from Pro Motion NG.

icoWidth: 9 (0x09)
icoHeight: 7 (0x07)
numColors: 0 (0x00)
reserved: 0 (0x00)
icoPlanes: 1 (0x0001)
icoBpp: 32 (0x0020)
dataSize: 504 (0x000001f8)
dataOffset: 22 (0x00000016)

bmpHeaderSize: 40 (0x00000028)
bmpWidth: 9 (0x00000009)
bmpHeight2: 14 (0x0000000e)
bmpPlanes: 1 (0x0001)
bmpBpp: 32 (0x0020)
bmpCompress: 0 (0x00000000)
bmpChunk: 0 (0x00000000)

I noticed in the diagnostic printout that the data size was 504.The file only has 426 bytes.

Row 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 00 00 01 00 01 00 09 07 00 00 01 00 20 00 40 01
00000010 00 00 16 00 00 00 28 00 00 00 09 00 00 00 0E 00
00000020 00 00 01 00 20 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FD
00000040 FF FF 16 DB 96 FF 2F B5 37 FF 5B 95 00 FF 88 78
00000050 00 FF A1 49 29 FF 92 24 49 FF 82 0B 71 FF 55 00
00000060 AA FF 00 DD FF FF 03 F8 E9 FF 1D D2 7B FF 32 AC
00000070 14 FF 62 8C 00 FF 98 6D 00 FF 00 00 00 00 91 1E
00000080 53 FF 7A 08 81 FF 00 BE FF FF 00 E7 FF FF 09 EE
00000090 CE FF 25 C8 66 FF 41 A4 00 FF 00 00 00 00 00 00
000000A0 00 00 00 00 00 00 8D 18 5C FF 00 A1 FF FF 00 C8
000000B0 FF FF 00 00 00 00 10 E5 B2 FF 2B BF 4F FF 50 9D
000000C0 00 FF 00 00 00 00 A4 53 1D FF 92 2A 3D FF 00 7C
000000D0 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 16 DB
000000E0 96 FF 2F B5 37 FF 5B 95 00 FF 88 78 00 FF A1 49
000000F0 29 FF 00 53 FF FF 00 88 FF FF 00 00 00 00 00 DD
00000100 FF FF 03 F8 E9 FF 1D D2 7B FF 32 AC 14 FF 62 8C
00000110 00 FF 98 6D 00 FF 00 00 FF FF 00 62 FF FF 00 95
00000120 FF FF 00 BE FF FF 00 E7 FF FF 09 EE CE FF 25 C8
00000130 66 FF 41 A4 00 FF 68 83 00 FF 00 00 00 00 02 00
00000140 00 00 07 00 00 00 22 00 00 00 70 00 00 00 20 00
00000150 00 00 00 00 00 00

This is hex dump for a 32bpp ico exported from GIMP. The data size listed is 320. The file size is 342 bytes.

Thanks for your time,
Jeremy

Hi @behreandtjeremy

thanks for the report. I just played around a bit, and yes, the programs don’t seem to load such files, but please see here:

Thus, a single icon file could store images of any size from 1×1 pixel up to 256×256 pixels (including non-square sizes)

The Windows file explorer displays the files correctly.

But, you are right that there is no warning if width or height exceeds 256 pixels. I should include a corresponding warning.

-Jan

P.S.: With Windows ANI files (animated cursors) there is such a warning, btw.

I think you misunderstand a secondary comment, which is a side point, not the main bug. The files are not properly formatted, regardless of their size. The example file I posted is 9x7. Irregular size just makes the problem easier to see.

Hi @behreandtjeremy,

indeed, I got it wrong and was too sloppy with reading all the details :smiley:
It only happens when you have a project with alpha transparency enabled. I fixed this for upcoming 8.0.11.

-Jan