Skip to content

Conversation

mrjschulte
Copy link
Contributor

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.

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.
@RunDevelopment
Copy link
Member

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?

@mrjschulte
Copy link
Contributor Author

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?

This node allows the user to convert from a "Premultiplied" Alpha channel state to a "Straight/Unpremultiplied" alpha channel state, and vice versa.
@mrjschulte
Copy link
Contributor Author

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.
@mrjschulte mrjschulte marked this pull request as draft February 19, 2024 01:46
Copy link
Member

@RunDevelopment RunDevelopment left a 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!

Reworked the PR to use the suggested naming and concepts.
@mrjschulte mrjschulte marked this pull request as ready for review February 27, 2024 05:24
@joeyballentine joeyballentine changed the title Create "Premultiply Node" Create "Premultiplied Alpha" Node Feb 27, 2024
@joeyballentine joeyballentine merged commit 3be5841 into chaiNNer-org:main Feb 27, 2024
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