How to create 256x256 32-bit PNG icons for Windows?

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.
Post Reply
Knightmare
Posts: 63
Joined: Thu Feb 09, 2012 1:55 am

How to create 256x256 32-bit PNG icons for Windows?

Post by Knightmare »

I've examined the .ico files that some newer games use, and the largest image is usually a 256x256 32-bit PNG image. It's not made from a PNG image, it's an actual PNG inside the .ico file.

I've tried making my own icon in this format by pasting a 256x256 image into the icon editor in Visual Studio 2008, and it always ends up as BMP format, making the icon itself over 200KB!

I've also tried overwriting the images in these icons, and found that VS2008 won't let you paste over the PNG variant.

Does anybody know what editor was used to create icons with this internal format? I've created a nice 256x256 icon for KMQ2, but I don't want to bloat the .exe size by 200KB.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by mh »

I don't know what program Microsoft themselves use, but I do know that IcoFX is capable of making this kind of icon, and when subsequently opened in the Visual Studio resource editor correctly shows that the 256x256 icon is in PNG format.

IcoFX used to be freeware but recent versions are commercial. You should still be able to find the free version on the usual download sites.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by mh »

...and here's Microsoft's own icon-making workflow from the XP days: https://msdn.microsoft.com/en-us/library/ms997636.aspx

Of course the icons described here max out at 48x48, but it still does handle the 32-bit with 8-bit alpha case and is probably similar enough to the current workflow.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by Spike »

when in doubt, write your own...

https://en.wikipedia.org/wiki/ICO_%28file_format%29
should just be a couple of simple headers.
grab a hex editor, insert 22 bytes infront of your png, and edit them accordingly.

then open it up with msvc and add in your extra 32*32/16*16 images for winxp/earlier.
Johnny Law
Posts: 22
Joined: Mon Apr 28, 2014 8:34 pm
Location: San Carlos, CA
Contact:

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by Johnny Law »

A quick test with GIMP on my Mac:

- Created a 256x256 image in RGB color format.
- Chose to export as a Windows Icon (.ico) file.
- The export dialog gives me color depth/palette options as well as a checkbox for PNG compression.

That might be what you want? My test output file (which should be 24-bit PNG in the icon) is at https://dl.dropboxusercontent.com/u/116 ... p/test.ico
Johnny Law
Posts: 22
Joined: Mon Apr 28, 2014 8:34 pm
Location: San Carlos, CA
Contact:

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by Johnny Law »

Or I guess specifically you were looking for 32-bit, so I also tried that: https://dl.dropboxusercontent.com/u/116 ... /test2.ico
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by revelator »

xnview which is free can also make 32 bit icons :)
Productivity is a state of mind.
Knightmare
Posts: 63
Joined: Thu Feb 09, 2012 1:55 am

Re: How to create 256x256 32-bit PNG icons for Windows?

Post by Knightmare »

I finally got it working right with the free version of IcoFx. Thanks to everyone who replied.

My first few attempts resulted in smaller versions of the icon (48x48 and 64x64) with an alpha channel which I didn't want. When I tried editing it in Visual Studio to fix it, Windows would no longer display the 256x256 version of the icon. This was complicated by the icon caching in Windows 7, which will always display the same image for a given icon file, even after you've edited it, unless you rename or copy it somewhere else or reboot. I miss the days of forcing an icon cache rebuild with TweakUI.

I gave up for a while, but then came back and tried importing (in IcoFx) smaller versions of the image with the alpha channel removed, and everything ended up working correctly.
Post Reply