# Qwen Image 2.1 - SD.CPP - terminal scripts

> Source: <https://gist.github.com/ricardosantos79/e37510c6a0f029d402b403c1aa814393>
> Published: 2026-11-13 09:34:07+00:00

|  | #!/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=""" | 
|  | <lora:qwen-image-2.1-outpaint-v2:1.0> | 
|  | Outpaint the image: replace the solid gray areas with a seamless continuation of the scene, keeping the existing picture unchanged. | 
|  | Scene: <description> | 
|  | """ | 
|  | ./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 \ | 
|  | --lora-model-dir ./models/lora/ \ | 
|  | --cfg-scale 6.0 --steps 20 --sampling-method euler -W 512 -H 768 --diffusion-fa \ | 
|  | --prompt "{$positive_prompt}" \ | 
|  | --negative-prompt "" \ | 
|  | -r output/bladerunner_ana-de-armas_joi_hologram-bridge_01.jpg \ | 
|  | --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 | 
|  | base_image=output/example-18.png | 
|  | style_image=output/i2i_2026-10-04_20_15_08_28547.png | 
|  | OUTPUT_FILE=output/i2i_$( date '+%F_%H_%M_%S' )_$CURRENT_SEED.png | 
|  | positive_prompt=""" | 
|  | apply <image2> art style to <image1> | 
|  | """ | 
|  | ./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 --diffusion-fa \ | 
|  | --prompt "{$positive_prompt}" \ | 
|  | --negative-prompt "" \ | 
|  | -r $base_image \ | 
|  | -r $style_image \ | 
|  | --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=""" | 
|  | This is an RGBA image with transparency. make the white background transparent. The image has alpha channel and the background is transparent. | 
|  | """ | 
|  | ./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/i2i_2026-10-04_20_15_08_28547.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 | 
|  | input_prompt=""" | 
|  | a cartoon sloth mascot waving, flat vector illustration, bright colours | 
|  | """ | 
|  | # do not change `positive_prompt` as the model was trained to accept this schema. | 
|  | positive_prompt=""" | 
|  | This is an RGBA image with transparency. {$input_prompt}. The image has alpha channel and the background is transparent. | 
|  | """ | 
|  | ./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 "" \ | 
|  | --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=""" | 
|  | a cartoon sloth mascot waving, flat vector illustration, bright colours. | 
|  | """ | 
|  | ./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 1024 -H 1024 --diffusion-fa \ | 
|  | --prompt "{$positive_prompt}" \ | 
|  | --negative-prompt "" \ | 
|  | --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 |
