Skip to content

keep alpha channel #108

Open
Open

Description

@lxzmxl

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

Activity

  1. kornelski commented on Sep 11, 2023

    @kornelski
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions