libimagequant icon indicating copy to clipboard operation
libimagequant copied to clipboard

keep alpha channel

Open lxzmxl opened this issue 2 years ago • 1 comments

use opencv cv::imread to read a png,it's a 4 channel cv::mat with alpha channel. but when I use libimagequant to compress that png file and write to disk, opencv read it as a 3 channel cv::mat which lost alpha channel. how can I solve this problem. @leahneukirchen @mdonoughe @jaalto @rflynn

lxzmxl avatar May 05 '23 06:05 lxzmxl

PNG8 files don't have a separate alpha channel, they have transparency in palette entries. This should be possible to convert to a 4-channel image. Reading these files as 3-channel looks like an error.

I've seen people recommend IMREAD_UNCHANGED flag. Have you tried this?

kornelski avatar Sep 11 '23 10:09 kornelski