Batch image processing with FLUX.2 [klein 9B] Q4_K_M GGUF, HiDream-O1-Image, or Boogu-Image-0.1-Edit.
Run the same prompt across many images with dynamic prompting, static and dynamic reference images, support for multiple generations and step count modification along with multiple text encoders and loras. Optionally use HiDream-O1-Image or Boogu-Image-0.1-Edit as the backend model.
Repos, GGUFs, and other dependencies are cached under ~/.cache/flux-batch/.
-o) is created automatically if it doesn't exist.-rf) is also reread on each iteration — changes are detected by content comparison, and images are only reloaded when the file actually changes.edit-batch -i "*.jpg" -o new/ -p prompt.txt
# are skipped as comments.--count is automatically overridden to match the number of lines.Inline reference images (ref:<path>):
Prompt lines can embed reference image paths directly using ref:<path> syntax. These are extracted, loaded as reference images, and removed from the prompt text before it reaches the model. This composes with -r and -rf — all sources contribute to the reference pool.
# prompt.txt
Make the character wear the outfit ref:/tmp/hat.png ref:/tmp/jacket.png
Put the ball on the table ref:/tmp/ball.png
# No -r needed — refs are embedded in the prompt
edit-batch -i "*.jpg" -o out/ -p prompt.txt
Inline aspect ratio (ratio:<W>:<H>):
Prompt lines can embed an aspect ratio override using ratio:<W>:<H> syntax. This overrides --ratio from the command line for that prompt line.
# prompt.txt
Wide cinematic shot ratio:16:9
Square format ratio:1:1
Inline steps (steps:<int>):
Prompt lines can embed a step count override using steps:<int> syntax. This overrides --steps from the command line for that prompt line.
# prompt.txt
Quick draft steps:4
High quality render steps:20
Here's an example. This is 960 frames.
Look at how frame-matched it is with the original. I even have a nice little peek-a-boo window to compare
https://github.com/user-attachments/assets/08e5e7ea-d49c-4cbd-9391-237583cf7396
A version posted on YouTube: https://youtu.be/8TdXRJQygyY?si=RCVXLUbkEInJ_Z0r
I did this for over 5,000 frames in the video, automatically with edit-batch. Here's a few up close!
By default, edit-batch uses the censored FLUX text encoder. Alternative text encoders can be enabled:
--exact: Loads dx8152/Flux2-Klein-9B-Consistency LoRA for improved consistency--nsfw: Uses ponpoke/flux2-klein-9b-uncensored-text-encoder text encoder for unrestricted content# Use exact encoder (LoRA)
edit-batch --exact -i "*.jpg" -o out/ -p prompt.txt
# Use uncensored encoder
edit-batch --nsfw -i "*.jpg" -o out/ -p prompt.txt
Use --model hidream to run HiDream-O1-Image, a natively unified 8B image generation model. This is text-to-image only (no img2img conditioning) — input image globs provide size reference but aren't used for content.
# Basic text-to-image
edit-batch --model hidream -o out/ -p prompt.txt --width 1024 --height 1024
# Use dev model (28-step distilled variant)
edit-batch --model hidream --model-type dev -o out/ -p prompt.txt
You'll need the HiDream repo dependencies installed (pip install -r /path/to/HiDream-O1-Image/requirements.txt) and transformers>=4.57.1.
HiDream-only flags:
| Flag | Default | Description |
|---|---|---|
--model | flux | Model to use: flux, hidream, or boogu |
--model-type | full | full (25 steps, guidance 5.0) or dev (28 steps, guidance 0.0) |
--guidance-scale | * | Guidance scale (5.0 full, 0.0 dev) |
--seed | 42 | Random seed for reproducibility |
Use --model boogu to run Boogu-Image-0.1-Edit-Turbo, a 10B unified image editing model with DMD few-step inference.
When no --boogu-path is given, the script automatically:
The pipeline runs in DMD turbo mode (4 steps, no CFG by default). When the default guidance scales (--text-guidance-scale 5.0 --image-guidance-scale 1.0) are unchanged, the script auto-adjusts both to 1.0 for DMD.
# Basic image editing
edit-batch --model boogu -i "*.jpg" -o out/ -p prompt.txt
# Text-to-image only (no input image)
edit-batch --model boogu -o out/ -p prompt.txt --width 1024 --height 1024
Boogu flags:
| Flag | Default | Description |
|---|---|---|
--boogu-path | — | Path to local full-precision Boogu-Image-0.1-Edit directory (skips GGUF auto-setup) |
--text-guidance-scale | 5.0 | Text guidance scale; auto-set to 1.0 for DMD turbo if defaults unchanged |
--image-guidance-scale | 1.0 | Image guidance scale |
Requirements: bitsandbytes (installed automatically) for 4-bit MLLM quantization. ~12 GiB VRAM needed for 1024² generation.
Use --skeleton to guide generation with detected human poses or custom skeleton images:
# Auto-detect pose from input images and apply skeleton control
edit-batch --skeleton -in "*.jpg" -out pose_out/ -p prompt.txt
# Pure skeleton lines (no Canny edges)
edit-batch --skeleton --skeleton-mode skeleton -in "*.jpg" -out pose_out/ -p prompt.txt
# Use pre-generated skeleton image (reused for all inputs)
edit-batch --skeleton --skeleton-image pose.png -in "*.jpg" -out out/ -p prompt.txt
# Use globbed skeleton images paired with input images
edit-batch --skeleton --skeleton-image "poses/*.png" -in "*.jpg" -out out/ -p prompt.txt
# Adjust control strength (0.0-1.0)
edit-batch --skeleton --skeleton-strength 0.8 -in "*.jpg" -out out/ -p prompt.txt
Skeleton modes:
auto (default): Renders skeleton lines, then applies Canny edge detectionskeleton: Pose skeleton lines onlyedges: Skeleton lines + Canny edges on skeletoncanny: Canny edge detection on original input image| Flag | Description |
|---|---|
-p / --prompt | Prompt file |
-o / --out | Output directory |
| Flag | Default | Description |
|---|---|---|
-i / --in | — | Glob pattern for input images (e.g. "*.jpg") |
-c / --count | 1 | Number of images to make |
--cumulative | false | Chain generations: each output becomes a reference for the next (boogu: added as input_images; other models: tracked in memory) |
-d / --device | cuda | Torch device |
-s / --steps | 4 | Inference steps |
-r / --ref | — | Reference image(s) for style/content. Supports glob patterns; matched files cycle in cadence with input images |
--skeleton | — | Enable skeleton ControlNet mode for pose-guided generation |
--skeleton-mode | auto | Skeleton extraction mode: auto, skeleton, edges, canny |
--skeleton-strength | 0.6 | ControlNet conditioning scale (0.0-1.0) |
--skeleton-image | — | Pre-generated skeleton/control image (supports glob patterns) |
--controlnet | InstantX/FLUX.1-dev-Controlnet-Canny | ControlNet model |
--exact | false | Use exact text encoder (LoRA) |
--nsfw | false | Use uncensored text encoder + anatomy fixer LoRA |
--nsfw-lora | — | Custom LoRA URL/path for --nsfw (default: Klein anatomy fixer from CivitAI) |
--lora-strength | 2.5 | LoRA strength (recommended range: 1.0-3.0) |
--scale | 1.0 | Output size multiplier relative to input (e.g. 0.5 for half, 2.0 for double) |
--max-width | — | Maximum width constraint; overrides --scale, maintains aspect ratio |
--max-height | — | Maximum height constraint; overrides --scale, maintains aspect ratio |
--ratio | — | Target aspect ratio (e.g. 16:9, 4:3); applied after scale/max constraints, then reclamped to max bounds |
--offset | 0 | Start reading prompt file from this line (default: 0) |
-rf / --ref-file | — | File listing reference images (one per line); re-read each iteration like --prompt, reloads images only on content change |
--shuf | false | Shuffle input file order randomly |
-nc | false | No Clobber — skip existing outputs |
--model | flux | Model backend: flux, hidream, or boogu |
| --model-type | full | HiDream variant: full (25 steps) or dev (28 steps) |
| --guidance-scale | * | HiDream guidance scale (5.0 full, 0.0 dev) |
| --text-guidance-scale | 5.0 | Text guidance scale for Boogu |
| --image-guidance-scale | 1.0 | Image guidance scale for Boogu |
| --seed | 42 | Random seed for generation |
88 commits
Python
100.0%
Batch image processing with FLUX.2 [klein 9B] Q4_K_M GGUF, HiDream-O1-Image, or Boogu-Image-0.1-Edit.
Run the same prompt across many images with dynamic prompting, static and dynamic reference images, support for multiple generations and step count modification along with multiple text encoders and loras. Optionally use HiDream-O1-Image or Boogu-Image-0.1-Edit as the backend model.
Repos, GGUFs, and other dependencies are cached under ~/.cache/flux-batch/.
-o) is created automatically if it doesn't exist.-rf) is also reread on each iteration — changes are detected by content comparison, and images are only reloaded when the file actually changes.edit-batch -i "*.jpg" -o new/ -p prompt.txt
# are skipped as comments.--count is automatically overridden to match the number of lines.Inline reference images (ref:<path>):
Prompt lines can embed reference image paths directly using ref:<path> syntax. These are extracted, loaded as reference images, and removed from the prompt text before it reaches the model. This composes with -r and -rf — all sources contribute to the reference pool.
# prompt.txt
Make the character wear the outfit ref:/tmp/hat.png ref:/tmp/jacket.png
Put the ball on the table ref:/tmp/ball.png
# No -r needed — refs are embedded in the prompt
edit-batch -i "*.jpg" -o out/ -p prompt.txt
Inline aspect ratio (ratio:<W>:<H>):
Prompt lines can embed an aspect ratio override using ratio:<W>:<H> syntax. This overrides --ratio from the command line for that prompt line.
# prompt.txt
Wide cinematic shot ratio:16:9
Square format ratio:1:1
Inline steps (steps:<int>):
Prompt lines can embed a step count override using steps:<int> syntax. This overrides --steps from the command line for that prompt line.
# prompt.txt
Quick draft steps:4
High quality render steps:20
Here's an example. This is 960 frames.
Look at how frame-matched it is with the original. I even have a nice little peek-a-boo window to compare
https://github.com/user-attachments/assets/08e5e7ea-d49c-4cbd-9391-237583cf7396
A version posted on YouTube: https://youtu.be/8TdXRJQygyY?si=RCVXLUbkEInJ_Z0r
I did this for over 5,000 frames in the video, automatically with edit-batch. Here's a few up close!
By default, edit-batch uses the censored FLUX text encoder. Alternative text encoders can be enabled:
--exact: Loads dx8152/Flux2-Klein-9B-Consistency LoRA for improved consistency--nsfw: Uses ponpoke/flux2-klein-9b-uncensored-text-encoder text encoder for unrestricted content# Use exact encoder (LoRA)
edit-batch --exact -i "*.jpg" -o out/ -p prompt.txt
# Use uncensored encoder
edit-batch --nsfw -i "*.jpg" -o out/ -p prompt.txt
Use --model hidream to run HiDream-O1-Image, a natively unified 8B image generation model. This is text-to-image only (no img2img conditioning) — input image globs provide size reference but aren't used for content.
# Basic text-to-image
edit-batch --model hidream -o out/ -p prompt.txt --width 1024 --height 1024
# Use dev model (28-step distilled variant)
edit-batch --model hidream --model-type dev -o out/ -p prompt.txt
You'll need the HiDream repo dependencies installed (pip install -r /path/to/HiDream-O1-Image/requirements.txt) and transformers>=4.57.1.
HiDream-only flags:
| Flag | Default | Description |
|---|---|---|
--model | flux | Model to use: flux, hidream, or boogu |
--model-type | full | full (25 steps, guidance 5.0) or dev (28 steps, guidance 0.0) |
--guidance-scale | * | Guidance scale (5.0 full, 0.0 dev) |
--seed | 42 | Random seed for reproducibility |
Use --model boogu to run Boogu-Image-0.1-Edit-Turbo, a 10B unified image editing model with DMD few-step inference.
When no --boogu-path is given, the script automatically:
The pipeline runs in DMD turbo mode (4 steps, no CFG by default). When the default guidance scales (--text-guidance-scale 5.0 --image-guidance-scale 1.0) are unchanged, the script auto-adjusts both to 1.0 for DMD.
# Basic image editing
edit-batch --model boogu -i "*.jpg" -o out/ -p prompt.txt
# Text-to-image only (no input image)
edit-batch --model boogu -o out/ -p prompt.txt --width 1024 --height 1024
Boogu flags:
| Flag | Default | Description |
|---|---|---|
--boogu-path | — | Path to local full-precision Boogu-Image-0.1-Edit directory (skips GGUF auto-setup) |
--text-guidance-scale | 5.0 | Text guidance scale; auto-set to 1.0 for DMD turbo if defaults unchanged |
--image-guidance-scale | 1.0 | Image guidance scale |
Requirements: bitsandbytes (installed automatically) for 4-bit MLLM quantization. ~12 GiB VRAM needed for 1024² generation.
Use --skeleton to guide generation with detected human poses or custom skeleton images:
# Auto-detect pose from input images and apply skeleton control
edit-batch --skeleton -in "*.jpg" -out pose_out/ -p prompt.txt
# Pure skeleton lines (no Canny edges)
edit-batch --skeleton --skeleton-mode skeleton -in "*.jpg" -out pose_out/ -p prompt.txt
# Use pre-generated skeleton image (reused for all inputs)
edit-batch --skeleton --skeleton-image pose.png -in "*.jpg" -out out/ -p prompt.txt
# Use globbed skeleton images paired with input images
edit-batch --skeleton --skeleton-image "poses/*.png" -in "*.jpg" -out out/ -p prompt.txt
# Adjust control strength (0.0-1.0)
edit-batch --skeleton --skeleton-strength 0.8 -in "*.jpg" -out out/ -p prompt.txt
Skeleton modes:
auto (default): Renders skeleton lines, then applies Canny edge detectionskeleton: Pose skeleton lines onlyedges: Skeleton lines + Canny edges on skeletoncanny: Canny edge detection on original input image| Flag | Description |
|---|---|
-p / --prompt | Prompt file |
-o / --out | Output directory |
| Flag | Default | Description |
|---|---|---|
-i / --in | — | Glob pattern for input images (e.g. "*.jpg") |
-c / --count | 1 | Number of images to make |
--cumulative | false | Chain generations: each output becomes a reference for the next (boogu: added as input_images; other models: tracked in memory) |
-d / --device | cuda | Torch device |
-s / --steps | 4 | Inference steps |
-r / --ref | — | Reference image(s) for style/content. Supports glob patterns; matched files cycle in cadence with input images |
--skeleton | — | Enable skeleton ControlNet mode for pose-guided generation |
--skeleton-mode | auto | Skeleton extraction mode: auto, skeleton, edges, canny |
--skeleton-strength | 0.6 | ControlNet conditioning scale (0.0-1.0) |
--skeleton-image | — | Pre-generated skeleton/control image (supports glob patterns) |
--controlnet | InstantX/FLUX.1-dev-Controlnet-Canny | ControlNet model |
--exact | false | Use exact text encoder (LoRA) |
--nsfw | false | Use uncensored text encoder + anatomy fixer LoRA |
--nsfw-lora | — | Custom LoRA URL/path for --nsfw (default: Klein anatomy fixer from CivitAI) |
--lora-strength | 2.5 | LoRA strength (recommended range: 1.0-3.0) |
--scale | 1.0 | Output size multiplier relative to input (e.g. 0.5 for half, 2.0 for double) |
--max-width | — | Maximum width constraint; overrides --scale, maintains aspect ratio |
--max-height | — | Maximum height constraint; overrides --scale, maintains aspect ratio |
--ratio | — | Target aspect ratio (e.g. 16:9, 4:3); applied after scale/max constraints, then reclamped to max bounds |
--offset | 0 | Start reading prompt file from this line (default: 0) |
-rf / --ref-file | — | File listing reference images (one per line); re-read each iteration like --prompt, reloads images only on content change |
--shuf | false | Shuffle input file order randomly |
-nc | false | No Clobber — skip existing outputs |
--model | flux | Model backend: flux, hidream, or boogu |
| --model-type | full | HiDream variant: full (25 steps) or dev (28 steps) |
| --guidance-scale | * | HiDream guidance scale (5.0 full, 0.0 dev) |
| --text-guidance-scale | 5.0 | Text guidance scale for Boogu |
| --image-guidance-scale | 1.0 | Image guidance scale for Boogu |
| --seed | 42 | Random seed for generation |
88 commits
Python
100.0%