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

Improve trimming of images with transparency #1879

Closed
wants to merge 2 commits into from

Conversation

muse-monotype
Copy link

Retrieve the background colour alpha value and pass image alpha band to find_trim() if background colour is not fully opaque. Attempt to fix issue #1597

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.756% when pulling 8455963 on Monotype:master into fb5c393 on lovell:master.

@lovell
Copy link
Owner

lovell commented Sep 22, 2019

Thanks for the PR. Am I correct in thinking that if the top left pixel has any transparency then only the alpha channel is used for the trim? I'm not sure this is the desired behaviour, or at least could break backwards compatibility.

Perhaps a two-step process could be used instead, where if the initial call to find_trim returns zero offsets and the image has an alpha channel, then perform a second call on just the alpha channel.

@Insality
Copy link

Any info about this PR? Have the same trouble with black and transparency and this PR will solve it

And I can't make working package from @muse-monotype fork working on windows (have no software to build-from-source it)

@lovell
Copy link
Owner

lovell commented Nov 14, 2019

I've addressed this in commit c41b873, which adds support for trimming images where the alpha channel contains the "data" (and non-alpha channels are a single colour) and maintains backwards compatibility with existing behaviour.

@muse-monotype Thank you very much for taking the time to submit the original PR Martin, these are always highly appreciated.

@lovell lovell closed this Nov 14, 2019
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.

4 participants