NoRaincheck

Inpainting with Generative AI

Inpainting with Generative AI

If anything, trying to do generative AI (images) via CLI is unusually ‘hard’. Mostly because most flows use ComfyUI. I have found ComfyUI to be great when trying things out, or doing things interactively.

The easiest way to use CLI/scripting has definitely been stable-diffusion.cpp: https://github.com/leejet/stable-diffusion.cpp

For inpainting, it looks like the below

 1./bin/sd-cli \
 2  --diffusion-model flux-2-klein-9b-Q4_0.gguf \
 3  --vae flux2_dev_diffusion_pytorch_model.safetensors \
 4  --llm Qwen3-8B-Q3_K_M.gguf \
 5  --init-img bench.jpg \
 6  --mask dog-bench-mask.png \
 7  -p "a lovely dog" \
 8  --cfg-scale 2 \
 9  --sampling-method euler \
10  -t 24 \
11  --color \
12  --steps 9 \
13  -H 512 \
14  -W 512 \
15  --vae-tiling \
16  --vae-tile-overlap 0.125 \
17  -o dog-lovely-bench.png

What is important (to me) is that I find that binary masks that ‘grows a bit’ is better than providing a fuzzy mask, on my hardware this runs reasonably quickly (~15s per step at 512x512).

<< Previous Post

|

Next Post >>

🎲 Random post

|

All posts

#ML #Image-Generation #CLI