Skip to content

Conversation

HomogenousMoss
Copy link

When doing a Cut by Mask, the +1 was always adding one pixel to the width and height of the output. It's a problem for example if you're trying to do multiples of 8 sizes so that the ksampler doesnt not resize the output to the nearest factor of 8.

I have an example thread on reddit about the issue:

…idth and height of the output. It's a problem for example if you're trying to do multiples of 8 sizes so that the ksampler doesnt not resize the output to the nearest factor of 8.
@Acly
Copy link

Acly commented Aug 22, 2023

Hi! I believe I just stumbled across the same issue, only I was 1 minute later with opening a PR #8!

However I do believe that the computation in CutByMask is actually correct: the max is inclusive, so to compute the width/height +1 must be added. Rather it is the MaskToRegion node which is broken. It already generates a mask which is 1 pixel too large, and therefore the cut becomes too large as well.

@HomogenousMoss
Copy link
Author

HomogenousMoss commented Aug 23, 2023

You're quite possibly right, it was my first time looking at python for comfyui, I just wanted this to work. I looked over your PR and it does seem like it would be a better solution. I'll close mine and hopefully yours get merged!

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.

2 participants