Menu

Does PNG-to-ICO transparency survive? A measured alpha test across 16-128 px
📰

Does PNG-to-ICO transparency survive? A measured alpha test across 16-128 px

DEV Community: css·banggui·14 days ago
#iyCu6K3L
#devtocss#devto#dev#alpha#transparent
Reading 0:00
15s threshold

Does PNG-to-ICO transparency survive? A measured alpha test across 16–128 px

Yes. A transparent WebP source converted to ICO keeps alpha = 0 at all four corners at every size from 16 to 128 px. Below is the pixel-by-pixel proof.

The question

When you save an image as JPEG, the alpha channel is gone — JPEG has no transparency. If your icon source was a JPG, renaming the file extension to .ico does not bring alpha back; the pixel data simply doesn't contain it.

But if your source is a PNG or WebP with an alpha channel, does the ICO conversion preserve it? I ran a measurement to find out.

Source image

A 256×256 RGBA image: a red rounded rectangle with a yellow circle at the center. The exterior is fully transparent (alpha = 0).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.