Skip to content

fix(nodes) paste_image paste mask transparency and img_scale add multiple of #8437

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Neosettler
Copy link

Summary

fix(nodes): paste_image, paste mask operation doesn't want a black backdrop. Black should translate to transparent and the hack here is to used the reference image instead. Thus, acting as transparent but it's technically not. + img_scale, add "multiple of" for convenience

Related Issues / Discussions

QA Instructions

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

fix(nodes): paste_image, paste mask operation doesn't want a black backdrop, black should translate to transparent, the hack here is to used the reference image instead, thus, acting as transparent but it's not. + img_scale, add "multiple of" for convenience
@github-actions github-actions bot added python PRs that change python files invocations PRs that change invocations labels Aug 18, 2025
@Neosettler
Copy link
Author

expected before and after result: image
image

Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It looks like this changes the existing node behaviours a bit and therefore is not backwards compatible. Can you please review and ensure the nodes are backwards compatible when the new fields are not set by the user?

@@ -180,7 +181,7 @@ def invoke(self, context: InvocationContext) -> ImageOutput:
new_image.paste(base_image, (abs(min_x), abs(min_y)))

# Create a temporary image to paste the image with transparency
temp_image = Image.new("RGBA", new_image.size)
temp_image = new_image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems off. We are assigning new_image to temp_image. They now both refer to the same object. Then we paste image onto temp_image. Finally, we do an alpha composite of new_image and temp_image - so alpha compositing the same image onto itself?

I think I understand the root issue you want to address, but if you can provide some example input images to test with, I'd be better able to review. Ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invocations PRs that change invocations python PRs that change python files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants