Skip to content

Conversation

@tristanphease
Copy link
Contributor

Currently when encoding alpha data for lossy images it doesn't encode it which causes those images to be very strange looking. This PR just encodes the raw alpha data in an alpha chunk as in https://developers.google.com/speed/webp/docs/riff_container#alpha
Should add the lossless compression method encoding in a later PR, may want to refactor out the lossless encoding code for that.

@fintelia fintelia merged commit 1e7c79f into image-rs:main Oct 19, 2025
7 checks passed
@fintelia
Copy link
Contributor

I believe that the existing lossless ColorType::L8 could should work pretty well for alpha chunks. Technically it wastes a few bits making sure that the other channels have the right values, but the difference should be very minor.

@tristanphease tristanphease deleted the lossy-encoder-5-fix-alpha-encoding branch October 20, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants