Generate images locally via ComfyUI API + Flux.1 Dev. No API cost, excellent text rendering.
ComfyUI must be running (default port 8200):
bash
# 启动
bash /Users/chrisliu/ComfyUI/start.sh
# 关闭
bash /Users/chrisliu/ComfyUI/stop.sh
Override URL via env: COMFYUI_URL=http://127.0.0.1:8200
Models (already installed):
flux1-dev.safetensors (diffusion model)t5xxl_fp8_e4m3fn.safetensors + clip_l.safetensors (text encoders)ae.safetensors (VAE)bash
python3 {baseDir}/scripts/flux_generate.py --prompt "PROMPT" [OPTIONS]
bash
python3 {baseDir}/scripts/flux_generate.py \
--prompt "A professional presentation slide with title 'AI Revolution' in bold white text on dark gradient background"
bash
python3 {baseDir}/scripts/flux_generate.py \
--prompt "..." \
--width 1344 --height 768
ParameterDefaultDescription--prompt(required)Image description--negative""Negative prompt--width1024Image width--height1024Image height--steps20Sampling steps (more = better but slower)--cfg1.0CFG scale (Flux works best at 1.0)--seedrandomReproducibility seed--outputautoOutput path (default: generated-images/flux-{ts}.png)--timeout600Max wait seconds
Use CaseSizeFlagSquare1024×1024(default)PPT 16:91344×768--width 1344 --height 768Portrait768×1344--width 768 --height 1344Landscape1344×768--width 1344 --height 768
Generate images with a reference face using PuLID-Flux (zero API cost, zero censorship):
bash
python3 {baseDir}/scripts/pulid_generate.py \
--prompt "PROMPT" \
--ref-image path/to/face.jpg [OPTIONS]
bash
python3 {baseDir}/scripts/pulid_generate.py \
--prompt "a girl sitting in a cafe, warm afternoon light, casual outfit" \
--ref-image avatars/kimi.jpg
bash
python3 {baseDir}/scripts/pulid_generate.py \
--prompt "a girl on the beach at sunset, wearing a sundress" \
--ref-image avatars/kimi.jpg \
--width 1024 --height 1024 \
--weight 1.2
ParameterDefaultDescription--prompt(required)Image description--ref-image(required)Reference face image path--negative""Negative prompt--width768Image width--height1024Image height (portrait default)--steps10Sampling steps (PuLID works well with fewer)--cfg3.5Guidance scale--seedrandomReproducibility seed--weight1.0Face similarity weight (0.0-5.0, higher = more similar)--start-at0.0PuLID start timestep--end-at1.0PuLID end timestep--outputautoOutput path (default: generated-images/pulid-{ts}.png)--timeout600Max wait seconds
--weight 1.0 is balanced; increase to 1.2-1.5 for stronger likeness--steps 10 is enough for PuLID; increase to 20 for more detailPrints MEDIA:<path> — auto-attached to chat reply. Default saves to generated-images/.
If ComfyUI is not running, the script exits with an error and prints startup instructions.