Inpaint only mask switch to img2img if mask is blank #15579
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
@storyicon
when performing
Inpaint
withonly mask
mode if the mask is blank (as in there's nothing to inpaint)currently web UI would throw an error
Fundamentally there is no real issue during this error because there's nothing to do, but the message bit cryptic
they might even be a minor beneficial as in it stops unnecessary processing
but it could also be disrupted when you're doing a batch job scenario
so this is an alternative limitation that would instead perform normal img2img if the mask is blank
implemented using a try block as I think this makes the code more readable
if ValueError ever occurred performs img2img and shows a message
in this PR I did not implement resizing of self.mask_for_overlay
unless my analysis is incorrect
that piece of code would only ever be triggered when performing
Inpaint Only mask
with a mask size different from the input imageif resizeing is peformed to the mask like in #15534, the resulting output would only be an inpaint with misaligned mask, the misalignment can vary from a little to a lot depending on the mask size difference
which in my viewpoint just makes the output erratic so the results will be erratic
if mask resizing is to be implementm for
Inpaint Only mask
, it should be performed before cropping of the maskthe issue is there is a certain quirk about the WebUI that makes making this a bit awkward
when using webui img2img vial API, it is possible to have multiple input images but only have ONE mask image
I think if we would want to support resizing of the input mask for
Inpaint Only mask
, we should make it possible to also input multiple mask image as well to make things consistentChecklist: