Qwen Image 2.1 - SD.CPP - terminal scripts A developer published a set of bash scripts for running Qwen Image 2.1 image editing locally through sd.cpp's sd-cli, pairing the Q4_K_M GGUF diffusion model and its bf16 VAE with a Qwen3-VL-8B-Instruct LLM and vision projector. The scripts cover text-guided edits, multi-region instruction-based edits, and LoRA-driven outpainting at 512x512 and 512x768 with 20 steps and a 6.0 CFG scale, logging elapsed time and opening each result automatically. | | /bin/bash | | | start time=$ date +%s | | | echo "" | | | CURRENT SEED=$RANDOM | | | OUTPUT FILE=output/i2i image-edit $ date '+%F %H %M %S' $CURRENT SEED.png | | | positive prompt=""" | | | the sloth fur color is now blue | | | """ | | | ./sd-cpp/sd-cli --diffusion-model models/qwen-image-2.1-Q4 K M.gguf \ | | | --vae models/qwen image 2.1 vae bf16.safetensors \ | | | --llm models/Qwen3-VL-8B-Instruct-Q4 0.gguf \ | | | --llm vision models/mmproj-F16 Qwen3-VL-8B-Instruct.gguf \ | | | --cfg-scale 6.0 --steps 20 --sampling-method euler -W 512 -H 512 --diffusion-fa \ | | | --prompt "{$positive prompt}" \ | | | --negative-prompt "" \ | | | -r output/t2i 2026-10-03 14 04 17 11803.png \ | | | --output "$OUTPUT FILE" | | | open the output image in the default associated app. | | | xdg-open "$OUTPUT FILE" | | | end time=$ date +%s | | | elapsed=$ end time - start time | | | echo "" | | | echo "Elapsed time: $elapsed seconds" | | | Wait for the user to press Enter | | | echo "" | | | echo "+-----------------------------------------------+" | | | echo "Press ENTER to Exit." | | | read -r | | | /bin/bash | | | start time=$ date +%s | | | echo "" | | | CURRENT SEED=$RANDOM | | | OUTPUT FILE=output/i2i $ date '+%F %H %M %S' $CURRENT SEED.png | | | positive prompt=""" | | | Remove the metal watch in the blue circle, change the hair in the red circle to black, and replace the area in the green circle with gray short-sleeved linen pajamas. | | | """ | | | ./sd-cpp/sd-cli --diffusion-model models/qwen-image-2.1-Q4 K M.gguf \ | | | --vae models/qwen image 2.1 vae bf16.safetensors \ | | | --llm models/Qwen3-VL-8B-Instruct-Q4 0.gguf \ | | | --llm vision models/mmproj-F16 Qwen3-VL-8B-Instruct.gguf \ | | | --cfg-scale 6.0 --steps 20 --sampling-method euler -W 512 -H 512 --diffusion-fa \ | | | --prompt "{$positive prompt}" \ | | | --negative-prompt "" \ | | | -r output/example-18.png \ | | | --output "$OUTPUT FILE" | | | open the output image in the default associated app. | | | xdg-open "$OUTPUT FILE" | | | end time=$ date +%s | | | elapsed=$ end time - start time | | | echo "" | | | echo "Elapsed time: $elapsed seconds" | | | Wait for the user to press Enter | | | echo "" | | | echo "+-----------------------------------------------+" | | | echo "Press ENTER to Exit." | | | read -r | | | /bin/bash | | | start time=$ date +%s | | | echo "" | | | CURRENT SEED=$RANDOM | | | OUTPUT FILE=output/i2i outpaint $ date '+%F %H %M %S' $CURRENT SEED.png | | | positive prompt=""" | | |