Skip to content
jtippet edited this page Mar 23, 2019 · 1 revision

ICO222: NoMaskedPixels

When storing a bitmap in an ICO file, the ICO file also requires a mask. The mask specifies which pixels are transparent: both for painting, and also possibly for hit-testing. For example, if the user clicks on a masked-out pixel of an icon, the GUI framework might choose to ignore the click.

You will receive warning ICO222 on an ICO frame that doesn't have a single masked-out pixel. In other words, the entire mask is 0's (where a 0 means that the pixel is not masked out).

This might be perfectly fine and intentional -- perhaps you have an icon that is a 32x32 pixel square, and you want every single pixel to be drawn to the screen. In that case, you can safely ignore this warning; all graphics libraries will handle your icon just fine.

But it's more common for this to be an unintentional authoring error. The reason is that many people (and even some ICO-editing tools) don't realize (or care) that there's a mask at all. So they just put a bunch of 0's there. That means that your icon will, in a few cases, be drawn with an ugly rectangular backfill behind it, since the graphics library thinks that every pixel is part of your icon.

If your icon is anything other than a giant square that is as big as the whole icon, you should regenerate the frame with a mask that indicates which parts of your icon are transparent. This will improve how your icon is drawn in certain cases. Note that IcoCat is clever enough to automatically generate a mask for you from a PNG's alpha channel.

You might receive this warning if another tool is sloppy about how it embeds bitmaps inside the ICO file. If you happen to know exactly which tool generated this icon, please file an issue here on GitHub with that info, so we can improve the documentation and tooling.

Clone this wiki locally