ivymike
ivymike

Reputation: 1591

How to set a pixel as transparent for 8-bit pngs when encoding with libpng?

I'm trying to mark pixels as transparent when encoding rgb data to 8-bit png image (palette) using libpng. If I create a separate alpha channel in this case, the alpha channel is getting ignored. Is there a way to set the pixels as opaque or transparent when using 8-bit color palette ?

Thanks

Upvotes: 1

Views: 711

Answers (1)

leonbloy
leonbloy

Reputation: 75926

To mark some palette index(es) as transparent, you must create a tRNS chunk. In libpng, I guess you must use the function png_set_tRNS()

Upvotes: 1

Related Questions