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

fix(canvas): use a corrected gradient mask for canvas pasteback #5855

Merged
merged 2 commits into from
Mar 3, 2024

Conversation

dunkeroni
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Have you discussed this change with the InvokeAI team?

  • Yes
  • No, because:

Have you updated all relevant documentation?

  • Yes
  • No

Description

  • Gradient Mask Node skips processing and returns tensorified version of image if edge_radius=0
  • Gradient Mask Node now outputs an image representing the expanded mask area of the gradient.
  • Canvas workflows use this expanded mask for the paste-back operation (goes through MASK_RESIZE_DOWN)

This enables two new use cases in workflows:

  • Inpainting graphs can use the output for paste operations in a larger image without losing gradient denoise details
  • Pre-made gradient mask images (by hand, depthmap, etc.) can be converted to mask tensors without modification and/or return an image of the total affected region.

This fixes a bug noticeable when using a large edge radius where the canvas paste back would clip the result to the original mask boundaries and then apply a paste operation along that edge. It will now respect the total area affected by denoising and compositing mask blur will be applied to that outer boundary.

QA Instructions, Screenshots, Recordings

Example of the bug: Edge Size 128, Minimum Denoise 0.3, Staged // Mask Blur 0
image

Merge Plan

This PR can be merged when approved

Added/updated tests?

  • Yes
  • No

Tagging @blessedcoolant in case of any ideas for a better implementation

@github-actions github-actions bot added python PRs that change python files invocations PRs that change invocations frontend PRs that change frontend files docs PRs that change docs labels Mar 3, 2024
@blessedcoolant
Copy link
Collaborator

Seems fine to me.

@hipsterusername hipsterusername merged commit 48e323d into invoke-ai:main Mar 3, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PRs that change docs frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants