开发者

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

开发者 https://www.devze.com 2023-04-10 04:10 出处:网络
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

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 tra开发者_开发技巧nsparent when using 8-bit color palette ?

Thanks


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号