floyo logo
Powered by
ThinkDiffusion
Pricing
Wan 2.7 is now live. Check it out 👉🏼
floyo logo
Powered by
ThinkDiffusion
Pricing
Wan 2.7 is now live. Check it out 👉🏼

FLUX.2 Klein 9B Image Inpainting

Inpainting image using Flux.2 Klein and LanPaint

1.3k

Generates in about -- secs

Nodes & Models

PrimitiveFloat
WorkflowGraphics
CLIPLoader
qwen_3_8b_fp8mixed.safetensors
VAELoader
flux2-vae.safetensors
UNETLoader
flux-2-klein-9b.safetensors
LoadImage
CLIPTextEncode
ImageScaleToTotalPixels
AddLabel
ConditioningZeroOut
VAEEncode
VAEDecode
GetImageSize
ImageScale
SetLatentNoiseMask
ReferenceLatent
FluxGuidance
SaveImage
ImageConcatMulti
PreviewImage
rookiepsi_ResizeMask
LanPaint_KSampler

Flux 2 Klein 9B inpainting with LanPaint. Paint a mask, describe what goes inside it, and Klein fills the region.

Upload your image and a mask that covers the area you want to change. Write a prompt describing the replacement, or reference a second image to pull the new content from. LanPaint handles the masked region with iterative refinement so edges blend cleanly and the fill matches the surrounding context. Everything outside the mask stays locked.

The default prompt ships as "replace the book in image 1 with the white cat from image 2." That's the range: swap one object for content from a reference image, described in plain language.

How do you use Flux 2 Klein 9B + LanPaint for inpainting?

Upload your image and a mask, write a prompt describing the change, and run. LanPaint replaces the default KSampler with an inpainting-specific sampler that applies extra refinement passes inside the masked region. Klein 9B handles fill quality. Everything outside the mask is untouched. No inpaint checkpoint needed.

Image 1 (source image) The image you want to edit. The mask defines which region changes. Everything outside the mask (background, unmasked subjects, colors, lighting) stays unchanged from this image.

Mask A black and white mask image where the white area defines the region to be inpainted. Paint the mask in ComfyUI's built-in mask editor or use a segmentation tool like SAM2 to generate it automatically from a subject selection. The more precise the mask, the cleaner the blend.

Image 2 (optional reference) Upload a second image when you want the fill to pull content from a visual reference rather than text alone. The default workflow uses this for object replacement: "replace X in image 1 with Y from image 2." Connect it via the ReferenceLatent node. One image provides the anchor; the other provides what goes in the mask.

Prompt Describe what you want inside the masked region. Klein follows natural language instructions and handles multi-part directives well. For text-guided fills: "a leather jacket," "an open window with city view," "remove the logo and show bare fabric." For reference-guided fills: name the source explicitly. "The white cat from image 2." "The chair from the reference image."

Prompting tips from the community: Add "high resolution" rather than "upscale" to push more detail into the fill. Add "subtle" before enhancement instructions for natural-looking results: "subtle enhanced skin texture." For color accuracy: "Strictly preserve all original colors, maintain exact color tones and saturation." For anatomy fixes: describe the correct version clearly: "five fingers, correct hand anatomy."

Guidance (default: 4) Controls how closely the output follows your prompt inside the masked region. 4 is the default. Want the fill to match the prompt more precisely? Go higher. Need the fill to blend more naturally with the surrounding image? Go lower.

Megapixels (default: 1MP) Output resolution for the full image. 1MP is the default. Lower it for faster preview runs before committing to the final edit. The mask region processes at the same resolution.

Steps (default: 4) LanPaint KSampler runs 4 steps by default. Klein 9B is distilled for fast inference, so 4 steps produces production-quality inpaints. LanPaint adds internal refinement passes within those steps for better structure and edge quality in the masked region.

What is Flux 2 Klein 9B + LanPaint inpainting good for?

Klein 9B + LanPaint handles any edit where you want to change a specific region of an image without touching the rest. Object replacement, object removal, clothing swaps, anatomy corrections, facial detail edits, and background segment changes. The mask limits the edit area; LanPaint handles clean integration at the boundary.

Object replacement. Replace one object in a scene with another, either from a text description or a reference image. Remove a product and place a different one. Swap a prop in a shot for a different version. The default workflow demonstrates this directly: replace the book with the white cat from image 2.

Object removal and cleanup. Paint a mask over a logo, watermark, wire, distracting background element, or anatomy error and prompt Klein to fill it cleanly. "Remove the logo and show bare fabric." "Remove the person and fill with matching background." LanPaint's refinement passes help the fill match surrounding texture and lighting.

Clothing and accessory edits. Mask a specific garment and describe or reference the replacement. Useful for iterating on outfit details in existing images without rerunning the full generation. For a full outfit swap, the clothes swap workflow is faster. For editing one specific piece while keeping everything else, inpainting is the right tool.

Anatomy corrections. Six fingers, misaligned hands, broken facial geometry. Mask the problem area and describe the correct anatomy. Klein handles this well when the surrounding context is clean and the mask is precise.

Facial detail edits. Mask a specific facial feature and edit it in isolation: eye color, skin texture in a region, hairstyle change. Finer than full img2img since only the masked region changes.

Honest notes: working with latents across multiple edits (rather than re-encoding from the output image each time) reduces color shift accumulation. For complex multi-step edits, save latents between passes. Color Match nodes help correct any drift between edits. The LanPaint sampler adds refinement passes which improves quality but increases generation time slightly over the standard KSampler.

How does LanPaint compare to standard KSampler inpainting for Flux Klein?

LanPaint replaces the standard KSampler with an inpainting-specific sampler that adds iterative refinement passes inside the masked region. Standard KSampler inpainting on Klein can produce edge artifacts and structural drift in the fill area. LanPaint's extra reasoning steps improve boundary blending and detail coherence without needing a separate inpaint-tuned checkpoint.

Standard KSampler inpainting works by masking the latent and denoising. The quality depends on how well the model handles the transition at the mask boundary. For Flux models that don't ship a dedicated inpaint finetune, this transition is where quality breaks down.

LanPaint addresses this by applying additional internal steps during the denoising pass specifically around the masked region. The fill integrates better with the surrounding unmasked area, and the structure inside the filled region is more coherent. The cost is slightly more processing per step.

For Klein specifically, LanPaint is the recommended path because Klein doesn't have a separate inpaint checkpoint. It brings inpaint-quality results to the base model.

FAQ

Does Flux 2 Klein 9B have a dedicated inpaint checkpoint? No. Klein 9B doesn't ship a separate inpaint finetune. LanPaint solves this by replacing the standard KSampler with an inpainting-specific sampler that works with the base model. You get inpaint-quality results without needing a separate checkpoint.

How precise does the mask need to be for Klein 9B inpainting? More precise masks produce cleaner results. A tight mask around the target region reduces the chance of bleed into surrounding areas. For portrait edits, use SAM2 to generate an automatic segment mask from a subject click. For simple object removal, a rough manual mask usually works.

How do I avoid color shifts when making multiple inpaint edits? Work with latents between passes rather than re-encoding from the output image each time. Save the latent after each edit and use it as the input for the next pass. Use a Color Match node to correct any drift. Adding "Strictly preserve all original colors" to your prompt also helps.

Can I replace an object in an image with content from a reference photo? Yes. Upload the reference as Image 2 and name it explicitly in your prompt: "replace the book in image 1 with the white cat from image 2." The ReferenceLatent node feeds the reference into the fill. The model reads the reference for appearance, color, and texture.

How do I run Flux 2 Klein 9B + LanPaint inpainting online? You can run this workflow online through Floyo. No installation, no setup. Open the workflow in your browser, upload your image and mask, and hit run. Free to try.

Read more

N