CivArchive
    Flux.2 / Klein Inpaint Segment Ultimate Edit - v2.0
    Preview 118578735
    Preview 118578733
    Preview 118578747
    Preview 118578746
    Preview 118578750
    Preview 118578759

    Segment anything and edit, swap, inpaint on them using Flux.2 Klein (or Dev)!
    Crop and stitch makes it so irrelevant parts of the image will not be altered, it will be faster and you can precisely control which edit (or reference image) goes where.


    How to use the workflow

    IMPORTANT TL;DR first on setting up the most important things.
    After setting the models, you have to at least prompt on the initialize node (top prompt will be applied to each segment, bottom is per-segment-prompt).
    At the Reference settings you have to prompt what to edit.
    These are the most important things, the rest you can adjust as you get to know the workflow better.

    Initialize
    - Select Model, CLIP and VAE.
    - Upload image to edit.
    - Select if you want to use reference image for each segment.
    - Prompt all (will be added first for every segment loop).
    - Prompt the segmented area individually (new line / enter between segments).

    Reference settings
    - Scale reference image size to Megapixels.
    - Remove BG: cuts background from the reference image.
    - Segment: prompt what you want to edit (character, or in the example vase).
    - Confidence: how "strict" the segmentation is; ie. lower gets less likely results, a very high value will only find what you've prompted for if it is extremely likely. Generally 0.3-0.5 works great.
    - Expand and blur mask is usually used to give the generation "more space" to move around; unmasked areas will not be touched.
    - Substract: useful when you have something within the mask that you absolutely want to keep as is (eg. the eyes of the segmented character, when you only want to edit other parts on her).
    - [SAM3/SAM2] model: select your segmentation model.
    - Use all segments: true will loop through every resulted segments. If you set it to false, you can select which segments to use. Refer to the Preview Segment node on the left - which is highly recommended to run first to preview the resulting segments before prompting and selecting them!

    Load image 1-4
    - Load reference images. If you have more segments than reference images, the rest will run only as normal edit (with no reference)! You can add more images if you need - or ask me to make them, if you don't want to engineer inside.

    Loop sampler
    - Use random seed: workaround to get random seeds within subgraphs. Set it to false for manual seed.
    - Seed (when not using random)
    - Steps, sampler, guidance (cfg) as normally
    - Scheduler: choose between Flux.2, Beta with model or normal schedulers; if set to normal, "scheduler for normal" lets you choose among the "usual" schedulers. My tests told me setting it to Beta is great - but you can always test and see what works best for you.
    - Scale: up/down scale segmented area upon crop.

    I have included 2 types of workflows, both with SAM2 and SAM3 version:
    - A simple edit (with no reference images); the rest of the functionality is the same.
    - A reference edit with up to 4 reference images (do ask me if you need more).

    Description

    Removed the different node packs for SAM2/SAM3/RemBG, and added RMBG3.0 nodes instead of all of them.
    Unpacked sub-subgraphs that might have additionally led to disconnected inputs.

    FAQ

    Comments (5)

    yaz152Jan 24, 2026· 3 reactions
    CivitAI

    v2.0 worked great for me. I had issues with 1.8 using the Reference SAM3 workflow, but now everything works smoothly. Great workflow, thanks for the update. I really appreciate your work.

    yorgash
    Author
    Jan 24, 2026

    You're very welcome!

    AcrossfyJan 25, 2026
    CivitAI

    V1 SAM3 didn't work. V2 simple SAM3 just goes straight OOM (on 32GB VRAM GPU).

    Ref WF worked at least for segmentation, but not for the result. So it would be great just to fix the segmentation for the simple workflow.

    yorgash
    Author
    Jan 25, 2026

    That's... weird.
    I ran it on 16 VRAM / 32GB RAM system and 24 / 96 one.
    Maybe it's trying to create hundreds of segments? Maybe threshold is too low and picks up hundreds of "similar to what he tries to segment" parts?

    FloatsYourStoatFeb 8, 2026· 2 reactions

    @yorgash 16GB VRAM here too and hit the same problem, setting device to cpu for the SAM segmentation nodes fixed the problem, takes a bit longer but it runs fine like that

    Workflows
    Flux.2 Klein 9B

    Details

    Downloads
    1,537
    Platform
    CivitAI
    Platform Status
    Available
    Created
    1/24/2026
    Updated
    5/3/2026
    Deleted
    -

    Files

    flux2KleinInpaint_v20.zip

    Mirrors

    Huggingface (1 mirrors)
    CivitAI (1 mirrors)