How to control matte / AND mask for Windows icons?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
eyebex
Posts: 10
Joined: 2012-06-16T12:33:28-07:00
Authentication code: 13

How to control matte / AND mask for Windows icons?

Post by eyebex »

I'm trying to write an 8-bit Windows icon whose pixels are fully transparent if the corresponding pixel in the 32-bit RGBA source image is fully transparent. I realize that transparency in 8-bit Windows icons is not handled by defining one of the 256 colors to be treated as transparent (like e.g. the GIF format does) but by a matte / AND mask that is stored in addition to the pixel data. While from looking at icon.c it seems it is able to write the mask, I did not yet succeed to call convert in a way that for a source alpha value == 0 a mask value of 0x00 is written, and for a source alpha value != 0 a mask value of 0xff is written. Any hints on how to do that?

PS: Back in this thread I was still thinking that Windows icon transparency is achieved by palette index transparency, which is wrong, see above.

Locked