CivArchive
    Preview 4354586

    Inpaint workflow V2

    GUIDE FOR V2 WORKFLOW IS LOCATED HERE

    06/12/2025

    -Added ability to control mask opacity.

    -Changed sampler to prevent problems with generation.

    -Adjusted guide.

    04/12/2025

    -Added ability to do colormatch. Changing colormatch setting to 1 will try to match the color of the image.This is good if using VAE that changes color between encode/decode cycle or using different lora/model.


    Older:

    -Added differential diffusion

    -Cleaned the workflow

    -Created guide which can be found HERE

    -This should work with 1.5 too, did not test.

    Inpaint workflow XL V1.1

    Due to request updated to work with XL. It is somewhat barebones compared to 1.5. Does not have segmentation or controlnet models currently.

    I have a bit outdated comfyui, let me know if it is throwing some errors.

    Description

    Fixed problem caused by updates.

    FAQ

    Comments (38)

    gimpi_galDec 12, 2023· 1 reaction
    CivitAI

    I keep getting the following error when I run the workflow.

    RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat1 in method wrapper_CUDA_addmm)

    Does anyone have an idea of what could be causing it?

    PotatCat
    Author
    Dec 14, 2023

    It could be you run out of vram, try doing smaller generate.

    gimpi_galDec 16, 2023

    @PotatCat It's weird because I'm looking at my RAM and VRAM when I try to generate and neither get even close to being full when I click generate and it still fails when using the LOW_VRAM mode as well (I have 12GB of VRAM and 16GB of RAM). It also always seems to fail when it gets to the Advanced Efficient KSampler.

    I'm using V3.1

    PS Wdym by smaller generate? Input a smaller image? Reduce the size of the inpaint segments?

    gimpi_galDec 16, 2023

    Aaand of course somehow after clicking the "update all" button in ComfyUI now it works just fine. 😭
    I'll take the W I guess

    PotatCat
    Author
    Dec 16, 2023

    @goxndosm Hehe (~ ̄▽ ̄)~

    Mister_KaosJun 15, 2024· 1 reaction

    CUDA is related to GPU. If you use windows and have NVIDIA card, your build probably uses CUDA to manage the compatibility drivers. If there is problem with CUDA, usually means something is wrong with one of the drivers. Updating them usually fixes the problem.

    disedgarnavarrete269Dec 14, 2023· 1 reaction
    CivitAI

    i cant get the control net tile to work, 'ControlNet' object has no attribute 'load_device'

    what is the specific one i should be using or how can i fix it?

    PotatCat
    Author
    Dec 14, 2023· 1 reaction

    @PotatCat yep, even tho my installation was days old the only thing i had to do was update it, thank

    PotatCat
    Author
    Dec 15, 2023

    @disedgarnavarrete269 Very nice :) Leave a review if you like the workflow! Motivates to update.

    ZikkiaiFeb 4, 2024· 13 reactions
    CivitAI

    Thats bad.
    1) why did you stick all nodes with pins?
    2) why did you smash all together to non-readable clutter?
    3) why did you call it inpaint, it is not allow to paint mask at all.
    So please rename, and make proper nice readable workflow before upload.

    PotatCat
    Author
    Feb 4, 2024· 6 reactions

    1) People hate moving parts, and i got request to pin them so i pinned them. People accidentally move stuff. Ofc for us who change workflow often and move things it's bad. You can just unpin them.


    2) Imo it is pretty readable and have generally gotten feedback on easy usability. There is video in the description how to use it.


    3) It does allow inpaint. You can paint mask by right clicking on the image load -> mask editor and switching the mode from SEGM to MASK.

    Nothing to rename, it works and have mostly gotten good feedback on usability. Cant please everyone.

    ZikkiaiFeb 7, 2024· 3 reactions

    @PotatCat  is there a way to unpin all at once?
    Yes, if someone can only upload an image and press a button, it will work.
    But i am someone, who wants to study, deconstruct, upgrade.

    Okay, for my own pipelines for public, perhaps, there can be two versions: noob-version and another for work.

    PotatCat
    Author
    Feb 7, 2024· 3 reactions

    @hitrpr325 Yes there is some nodepack that allowed that, when i made the workflow initially i had it installed and though that was base comfy thing. I don't have it anymore and i have no idea what it was. Tbh i was not aware it was from nodepack back then, and most likely would not have pinned everything if i knew that.

    As the workflow is json file, you can mass edit with "replace all" in notepad/notepad++ or any other editor by opening the .json file and mass replacing

    pinned": true

    To

    pinned": false

    That should unpin them all.

    ZikkiaiFeb 7, 2024· 2 reactions

    @PotatCat okay, «replace all» —  is a way, thanks.

    Mister_KaosJun 15, 2024· 1 reaction

    1) I agree. Whoever requested those pins needs to be whacked upside the head with rolling pin. Why are they using Comfy in the first place? Whole point of Comfy is that shit move around! They should use A1111 instead. Much easier for their simple 1 dimensional brain to understand. Or they come here to Civet and use Baby's First UI. Comfy for grownup only!

    2) So silly. Just need to read instruction manual!

    3) I think its the Group called MODE Selector with the 3 reroute nodes. Change wire from the Reroute node called SEGM to the one called MASK.

    jhonatankyllo743Feb 14, 2024· 1 reaction
    CivitAI

    I am trying to use it to restore photo of my dad as kid, it comes half way on the picture and the rest of the pic is the same. do you have any tips, is it becouse of the pic resolution beeing to high or must it be 1024 ? or please any other workflow that can restore colors on any picture ? Thanks amazing work man

    PotatCat
    Author
    Feb 15, 2024· 1 reaction

    Hey, Thank you for liking the workflow! Have not personally done much image restoration. This might not be the best workflow for that. If the area of the inpaint is too big compared to the image, it can start cutting it wrongly.

    If you trying to colorize image, you could try something like this https://www.youtube.com/watch?v=5W2_avVdMHM

    If you have photoshop it has some neural filter restoration tools that work nicely.

    jhonatankyllo743Apr 16, 2025

    @PotatCat ohh Thank you :)

    PotatCat
    Author
    Apr 16, 2025

    @jhonatankyllo743 (~ ̄▽ ̄)~

    flufflepimpFeb 23, 2024· 1 reaction
    CivitAI

    Got working but its not handling non square images. I am trying to do a 1344 x 768 . I set the In paint Segments to that size but the final result has a blue bar at the top . Any ideas?

    PotatCat
    Author
    Feb 23, 2024

    It cuts the inpaint part of image in square around the masked area -> inpaints the cut area -> pastes it back to the original image. You do not have to insert the image original size (~ ̄▽ ̄)~

    dadadiesMar 9, 2024

    @PotatCat Does that lose context of rest of the image cut out? Im using the default comfyui inpaint example and its not working. So going to give this a try.

    PotatCat
    Author
    Mar 10, 2024

    @dadadies No, it only inpaints the masked area

    dadadiesMar 10, 2024

    @PotatCat It says I am missing 'growmaskwithblur' which seems to supposed to be under KJNodes. Do you have 'growmaskwithblur'? Maybe `KJNodes' removed it.

    KeysuxMay 1, 2024· 1 reaction
    CivitAI

    [ERROR] PromptControl: Exception occurred during callback, unpatching model.

    [INFO] PromptControl: Unpatching model

    !!! Exception during processing!!! mat1 and mat2 shapes cannot be multiplied (154x2048 and 768x320)

    PotatCat
    Author
    May 1, 2024· 1 reaction

    Hey, did you use square resolution for the inpainted area?

    KeysuxMay 1, 2024

    @PotatCat It was my stupidity, was using XL model. Switched to 1.5 SD and it runs but it doesn't change the image, it masks and finishes but no change to image... https://i.imgur.com/GYYQbWE.jpeg

    PotatCat
    Author
    May 1, 2024· 1 reaction

    @trowieuk92915 Hmm.. I never usually use inpainting model, try if you use regular checkpoint. Also could try to lower the scaled soft controlnet weight multiplier. That controls how much the image changes. It is on the right.

    KeysuxMay 1, 2024

    @PotatCat using normal model did the trick. thank you so much for this and your help!

    PotatCat
    Author
    May 1, 2024

    @trowieuk92915 You welcome, have fun :)

    PoochilliMay 8, 2024· 3 reactions
    CivitAI

    Great workflow! It made me go back to comfyui for inpainting.

    The SAM is a nice addition for quick inpainting but we lack the control if the model decide to select parts we don't want. I added a manual mask that can either add or subtract from the detected area using comfyui shop or SAM . Maybe it's something you could implement.

    I know it's possible to use a mask in your version on the loader directly, but I think it's nice to still be able to use the SAM in addition to a manual mask for when it messes up an area.

    Added a screenshot to show what i mean.

    Also the "save clipspace" -> "paste clipspace" is a pain to deal with, I know it's a limitation of comfyUI, but having to do 4 clics to copy the result into the loader is annoying. Perhaps there is a custom node that does this for us ?

    PotatCat
    Author
    May 9, 2024· 1 reaction

    Hey, thank you for comment!

    Yeah, the SAM is a bit hit and miss, Never though about mixing the normal mask and SAM. That is actually pretty good idea and can be implemented pretty easily with combine mask.

    When i was actively updating this workflow, the nodes on masks and overall "inpainting" stuff were pretty limited. I have seen some good nodes pop up since i last updated this and could make it somewhat better.

    One way to continue from last image could be easily done with saving the inpainted image to specific location and always overwrite the previous image. Then have a switch for switching between the pasted image and the saved inpainted image you could load with some directory image loader from specific location.

    I don't know when or if i have time to delve into updating the workflow, might do it at some time if enough people have interest in it.

    Thank you for the comment, it means a lot :)

    PoochilliMay 9, 2024· 1 reaction

    @PotatCat Overwriting the loaded image with the saved image is a fantastic idea! Thank you for the tip ;)

    PotatCat
    Author
    May 9, 2024

    @Poochilli (~ ̄▽ ̄)~ i did that with some interrogation model

    Rance99Aug 31, 2024· 2 reactions
    CivitAI

    So I'm asking will there be a flux version?

    PotatCat
    Author
    Aug 31, 2024· 2 reactions

    Maybe one day.

    Rance99Aug 31, 2024· 1 reaction

    @PotatCat Thanks for your contribution, very much looking forward to it!

    Workflows
    SD 1.5

    Details

    Downloads
    4,530
    Platform
    CivitAI
    Platform Status
    Available
    Created
    12/9/2023
    Updated
    5/25/2026
    Deleted
    -

    Files

    comfyuiInpaint_15V31.zip

    Mirrors

    HuggingFace (1 mirrors)
    CivitAI (1 mirrors)