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.

Atom Feed for Comments 4 Responses to “Help Wanted: Icon Image Encoding for Windows and Mac”

  1. Talou Says:

    There is a gpl tool called png2ico
    I tried it : it works well !

  2. Chris Neale Says:

    GIMP 2.2.8 has some ability to create ico files – seems to work best from RGB rathered than indexed images.

  3. Benjamin Smedberg Says:

    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).

  4. Francis Gastellu Says:

    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 ;)

Leave a Reply