-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unflatten function - create an alpha channel and make white pixels fully transparent #3461
Conversation
Thanks for the PR, I'll be able to take a closer look in a couple of weeks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for this PR, sorry it took me a while to get around to reviewing it properly. I've added a couple of questions/thoughts inline.
@lovell Thanks for the feedback, I'll find some time to incorporate it over the next few weeks. |
…flatten operation to after the threshold operation in the pipeline sequence.
…hite to transparent)
@lovell Looks like prebuild is failing on arm64. I am doing an image compare with threshold=0. Not sure why it's breaking at this stage. Are there any platform-specific quirks to be aware of? |
libspng uses a specific NEON (SIMD) code path on ARM64 to unpack palette entries so its possible there may be a small rounding/clipping difference. It's probably nothing to worry about in the context of this change so feel free to allow a |
Thank you for the updates Anton, this looks great. Please can you add TypeScript definitions to index.d.ts then this is good to merge. |
Done, good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, looks great, I'll merge shortly.
maybe a similar api to the trim function |
@lovell A little something I'm working on. It creates a hard (0/255) alpha channel based on the pixel colour. Very keen to get your feedback on this. Note that it relates to #1648
It's currently limited to making lighter areas transparent (but easy enough to change how the threshold rules work). I'm still thinking about how to generalise it for mainstream use.
See provided images for example output (input was from the test image suite).