-
-
Notifications
You must be signed in to change notification settings - Fork 322
Create "Premultiplied Alpha" Node #2578
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
Create "Premultiplied Alpha" Node #2578
Conversation
This node premultiplies the RGB channels with the Alpha channel and produces an image with an "Associated pixel state". A lot of the graphics/workflows out there "assume" premultiplied RGBA channels so having this node available in chaiNNer's toolset will help it do more conversions that previously weren't possible in the application.
linting
I'm not really a fan of how the functionality of this PR and #2579 is presented. Pre-multiply what? I also don't like that both nodes' descriptions just tell you how they are implemented, but not what their purpose is. I think it would be better to have a node called "Premultiplied Alpha" that does both. This node would take an RGBA image and return an RGBA image. Whether it converts to premultiplied alpha or straight alpha is determined by a dropdown with the options "Straight -> Premultiplied" and "Premultiplied -> Straight". Since the node handles both conversions, we can explain the difference between straight and premultiplied alpha in its description and give use cases for both. What do you think? |
If I was to change this PR into a single node that would allow the user to select between unpremultiplying and premultiplying with an enum, would that help clear-up any concerns? |
…ments/premultiply.py
This node allows the user to convert from a "Premultiplied" Alpha channel state to a "Straight/Unpremultiplied" alpha channel state, and vice versa.
Hmmm looks like this latest update doesn't pass the backend lint even though the actual channel pad call was copied from an already existing chaiNNer node. Thoughts @joeyballentine ? |
Try and just force dtype to float32 to clear the backend linter.
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.
Sorry for the delayed response @mrjschulte!
backend/src/packages/chaiNNer_standard/image_adjustment/adjustments/premultiplied_alpha.py
Outdated
Show resolved
Hide resolved
backend/src/packages/chaiNNer_standard/image_adjustment/adjustments/premultiplied_alpha.py
Outdated
Show resolved
Hide resolved
Reworked the PR to use the suggested naming and concepts.
This node premultiplies the RGB channels with the Alpha channel and produces an image with an "Associated pixel state".
A lot of the graphics/workflows out there "assume" premultiplied RGBA channels so having this node available in chaiNNer's toolset will help it do more conversions that previously weren't possible in the application.