4

I'm releasing a .NET program, and am in the polishing up stage. I need to set the icon in the project properties. From my research, I would like to create images in the following pixel sizes to cater to all icon sizes: 16, 32, 48, 96, 256.

I have also found a program to convert the 5 pictures to a single ico file called "png2ico".

My problem is this. My source pictures are 32 bit (RGB + alpha) PNG files. I've heard only Vista and later supports reading of .ico files with PNG content in them, so is it dangerous then to use ico files with PNGs inside if I release to the general public who might only have Windows XP?

If I need to use ico files with BMP inside instead, is it dangerous to use 32 bit BMPs? I'd rather not use 24 bit BMPs due to bad anti-aliasing etc.

If I need to use BMP over PNG, is there any recommendation for a program which converts from multiple BMPs to a single .ico file?

Dan W
  • 3,520
  • 7
  • 42
  • 69

2 Answers2

3

png2ico takes png as source files but it doesn't state that it actually use png compression in the resulting ico file.

I recommend you to use Gimp, there you can create an image with a layer for each size you want the resulting ico to support. Then when you export/save as ico, it will ask you which compression you want for each layer.

For the biggest layers (96 and 256) it is pretty safe to use png compression, because usually older desktops don't display icons so big.

pmoleri
  • 4,238
  • 1
  • 15
  • 25
  • Gimp is a little overkill, though I may end up using it. PNG for 96 or 256 and BMP for anything lower sounds good, but can you really mix those in one ico file? Maybe I'd rather make them all BMP, even at the cost of filesize. – Dan W Aug 27 '12 at 21:33
  • Yes you can mix them, don't confuse the input format with the compression each icon will have in the resulting ico, think about the ico file as a container for multiple images, each one of them can have different bit depth and compression. If you have alpha channel (ie transparency degress), I recommend you to stick with png as input format, otherwise you will loose quality. – pmoleri Aug 28 '12 at 12:37
1

PNG images only display on Vista+ but should not cause issues on older versions.

32bit BMPs work correctly on XP+ and displays with broken alpha channel (black) on older versions (Can be avoided with a proper mask (Most icon editors don't support this for 32bpp images?), then it will display like a 24bpp image)

You really should use a real icon editor, there are several free applications out there.

Anders
  • 97,548
  • 12
  • 110
  • 164
  • If older OS versions than Vista don't support PNG inside .ico, then how will they even display the ico file? Will the icons be blank instead? – Dan W Aug 27 '12 at 21:29
  • As long as you provide other formats (Non-PNG) it should be OK – Anders Aug 28 '12 at 00:08
  • 1
    I tried around a dozen freeware/commercial utils, as I initially thought a full pixel editor was overkill (I used my own paint software). In the end though, they each had their own problem. So I used one of your two suggestions (IcoFX) which pretty much handles it all. Thankyou. For any in my position, first import the image, (then select the 256x256 option). Next, select "Create Windows Icon from Image" in IcoFX's 'Icon' menu, and it creates the other sizes from the original 256x256 32bit image automatically. Btw, XP doesn't seem to support the alpha channel (no icons have any anti-aliasing). – Dan W Aug 28 '12 at 22:16
  • XP supports 8bit alpha channel (32bpp ARGB bitmap). Here is the old XP icon guide: http://msdn.microsoft.com/en-us/library/ms997636.aspx and the older guide: http://msdn.microsoft.com/en-us/library/ms997538.aspx See also: http://blogs.msdn.com/b/oldnewthing/archive/2010/10/21/10078690.aspx – Anders Aug 29 '12 at 03:05