lquesada / ComfyUI-Inpaint-CropAndStitch

ComfyUI nodes to crop before sampling and stitch back after sampling that speed up inpainting
GNU General Public License v3.0
398 stars 23 forks source link

Can be the option in `Inpaint Crop` implemented to not expand image? #35

Closed bigcat88 closed 3 months ago

bigcat88 commented 3 months ago

Good day. I would like to ask, is it possible to add an option so that "context_expand_pixels" does not expand the image outward? So that if the mask + context_expand_pixels does not go beyond the edges of the input image?

Or how can this effect when image get mirrored outside for the size of "context_expand_pixels" can be avoided?

Screenshot from 2024-08-29 19-23-15

And I would like to thank you for the wonderful set of nodes, it is very useful.

lquesada commented 3 months ago

The solution is super super simple. Pass the result through the stitch node and it gets rid of the extended image and mirror. The crop and stitch nodes are meant to be used together, and always the two of them.

Extending the image is required to ensure the aspect ratio, and mirroring is referred to remove artifacts when using a denoise lower than 1.

So, just pass it through stitch and you're done!

On Thu, Aug 29, 2024, 18:26 Alexander Piskun @.***> wrote:

Good day. I would like to ask, is it possible to add an option so that "context_expand_pixels" does not expand the image outward? So that if the mask + context_expand_pixels does not go beyond the edges of the input image?

Or how can this effect when image get mirrored outside for the size of "context_expand_pixels" can be avoided?

Screenshot.from.2024-08-29.19-23-15.png (view on web) https://github.com/user-attachments/assets/3cc1ffad-4921-4dd1-92d8-99072a5816fa

And I would like to thank you for the wonderful set of nodes, it is very useful.

— Reply to this email directly, view it on GitHub https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch/issues/35, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCKTXJNIEA5R3LZGGO2VCLZT5DSXAVCNFSM6AAAAABNKZC2R6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ4TKMBRGM2DGNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bigcat88 commented 3 months ago

The problem is that the model who does the "inpainting" thinks that it can draw below or to the left/right of the picture and it draws and as a result half of what it drew becomes cut off.

lquesada commented 3 months ago

That is completely intended (to keep the aspect ratio so the model performs well). Pass it through stitch and it will keep the original image dimension.

On Thu, Aug 29, 2024, 19:24 Alexander Piskun @.***> wrote:

The problem is that the model who does the "inpainting" thinks that it can draw below or to the left/right of the picture and it draws and as a result half of what it drew becomes cut off.

— Reply to this email directly, view it on GitHub https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch/issues/35#issuecomment-2318437687, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCKTXPJ34Z2TJKHX5YETRLZT5KOPAVCNFSM6AAAAABNKZC2R6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJYGQZTONRYG4 . You are receiving this because you commented.Message ID: @.***>

bigcat88 commented 3 months ago

Thank you for quick replies.