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

Issue 1466 #1596

Merged
merged 4 commits into from
Nov 1, 2021
Merged

Issue 1466 #1596

merged 4 commits into from
Nov 1, 2021

Conversation

ForgottenMaster
Copy link
Contributor

Fix for DynamicImage::grayscale not preserving the alpha channel for input images that have an alpha channel. Fixes issue #1466

[src/imageops/colorops.rs]
Made new functions grayscale_alpha and grayscale_with_type_alpha which do the same as their non-alpha counterparts except they preserve the alpha channel
Uses LumaA rather than Luma for the pixel type
Uses .to_luma_alpha() rather than .to_luma()

[src/imageops/mod.rs]
Expose the new functions from the imageops module so we can access them in src/dynimage.rs

[src/dynimage.rs]
Updated DynamicImage::grayscale method to use grayscale_alpha/grayscale_with_type_alpha instead of the non-alpha counterparts when the input format has an alpha channel
Added tests to ensure that the alpha channel is discarded/preserved appropriately based on the input format

…etime bounds have been removed from the traits and are no longer required to be specified
@HeroicKatora HeroicKatora merged commit ceabd67 into image-rs:master Nov 1, 2021
@HeroicKatora
Copy link
Member

Thank you!

@ForgottenMaster ForgottenMaster deleted the issue-1466 branch November 1, 2021 23:49
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.

3 participants