Fix inpaint only masked pixels are shifted #16243
Open
+13
−1
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
Fixes bug: pasted image is shifted right and down on factor number of pixels after it was upscaled by this factor
This bug wasn't seen very often because rounded scale factor was almost always 1, and mask blur by default hides this artifact
Also this PR adds option to correct padding to have integer upscale on applying overlay
Screenshots/videos:
Original:
Options: padding=28, mask_blur=0, resolution=451x451, bad quality because I've used LCM, do not care about it
Old behavior:
Integer option on, but bug exists:
Here scale factor become 2, and it started look like a disaster. And this can happen and happens in current behavior anciently, if scale factor > 1 and upscale non integer
Integer option on and fixed bug:
Because this integer upscale correction can increase padding on 50-150 pixels, I've made it optional. If option is off, result is still better then the old behavior, but upscale is not integer (worse fit, better resolution):
Integer option off and fixed bug:
Checklist: