Help Wanted: Icon Image Encoding for Windows and Mac
If you’re a hacker who wants to help out Mozilla (and especially XULRunner), I’ve got a couple bugs that need owning: they both have to do with converting a cross-platform image format (probably PNG) into a platform-specific icon format.
- Bug 314651
- API to generate Mac .icns from a PNG image
- Bug 314030
- API to generate Windows icons from a PNG image
If you’re able and willing to help, please comment in the bug… I’ve got people who can help you with the Mozilla-API side of things such as getting image bit data from a PNG.
November 4th, 2005 at 11:50 am
There is a gpl tool called png2ico http://www.winterdrache.de/freeware/png2ico/
I tried it : it works well !
November 8th, 2005 at 7:56 am
GIMP 2.2.8 has some ability to create ico files – seems to work best from RGB rathered than indexed images.
November 14th, 2005 at 11:25 am
Guys, I need this to be an API within mozilla which can be called at runtime, not a build-time tool… gimp and png2ico don’t help at all (and I can’t use GPLed code in the moz codebase).
December 1st, 2005 at 6:28 am
For Windows, use the ICONINFO structure. You need to create two HBITMAPs, once for the mask (ie, based on png alpha channel), one for the pixel colors (respectively iconinfo.hbmMask, iconinfo.hbmColor, note that they shouldn’t be selected into an HDC or the icon creation will fail) then set iconinfo.fIcon to TRUE, and pick a value for xHotspot and yHotspot, and call CreateIconIndirect, then destroy the bitmaps. Free the icon with DestroyIcon. Should be simple enough ;)