Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep alpha channel #108

Open
lxzmxl opened this issue May 5, 2023 · 1 comment
Open

keep alpha channel #108

lxzmxl opened this issue May 5, 2023 · 1 comment

Comments

@lxzmxl
Copy link

lxzmxl commented May 5, 2023

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

@kornelski
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants