View all articles
ComfyUITutorialImage GenerationWorkflow

ComfyUI Batch Image Generation: 100 Product Images in Minutes

JG
Jacobo González Jaspe
|

Reviewed:

Abstract illustration: a prism fanning a white beam into amber and white rays. Creators
Illustration generated with AI on our own machine.

By the end of this post you will queue a whole product list through ComfyUI from a short Python script, with FLUX.1-schnell at 1024×1024, and you will know which batch size to use. On our DGX Spark that is about ten images a minute, so a hundred images take roughly ten minutes.

Start here if ComfyUI is not running yet: ComfyUI in 2026: set up a local product-image studio covers the install, the model folders and which model licences allow commercial use. This tutorial picks up where that one ends.

What you need

  • ComfyUI running locally, as in the stack guide. We run 0.25.0.
  • The model file flux1-schnell-fp8.safetensors (17.2 GB on disk) from Comfy-Org on Hugging Face, in models/checkpoints/. It bundles the image model, both text encoders and the VAE.
  • The licence check: FLUX.1 [schnell] is published under Apache 2.0 (model card, checked 2026-11-02), so you may use the images commercially.
  • Python 3 with no extra packages, and a text file with your products.

If your GPU has 12 GB or less, the stack guide’s FLUX.2 [klein] 4B is the safer first model. The script below works with any workflow exported in API format.

Step 1: Download the workflow

Download vorlux_flux_schnell_batch_api.json. It is the graph our own image service on the Spark uses: checkpoint loader, two text encoders, an empty 1024×1024 latent, a KSampler (4 steps, CFG 1.0, euler, simple), the VAE decoder and Save Image.

Drag it onto the ComfyUI canvas to inspect it; the frontend accepts API-format files. The node that decides the batch is EmptySD3LatentImage: its batch_size is set to 4. Schnell is a distilled 4-step model (ComfyUI examples), so more steps cost time without a clear gain.

Queue it once from the browser. Four images should land in output/batch/. If the loader shows the model name in red, the file is not in models/checkpoints/: move it and press R.

Step 2: Write the product list

One line per product: the file name you want and the words that describe it.

text
mug-white;white ceramic mug on a light oak table, soft window light, product photo
wallet-brown;brown leather wallet, top view, white background, product photo
lamp-brass;brass desk lamp on a walnut desk, warm evening light, product photo

Keep the scene words the same across a range (table, light, background). The model then varies the product, not the set.

Step 3: Queue the list from a script

flowchart LR
    A["products.txt\none line\nper product"] --> B["queue_batch.py\nprompt, seed\nand name"]
    B --> C["POST /prompt\none job\nper product"]
    C --> D["ComfyUI queue\nin order"]
    D --> E["KSampler\nFLUX.1-schnell\n4 steps, batch 4"]
    E --> F["VAE Decode"]
    F --> G["output/catalogue/\nname_00001_.png\n..."]

    style A fill:#FEF3C7,stroke:#F5A623,color:#000
    style B fill:#FEF3C7,stroke:#F5A623,color:#000
    style C fill:#DBEAFE,stroke:#2563EB,color:#000
    style D fill:#DBEAFE,stroke:#2563EB,color:#000
    style E fill:#D1FAE5,stroke:#059669,color:#000
    style F fill:#D1FAE5,stroke:#059669,color:#000
    style G fill:#D1FAE5,stroke:#059669,color:#000
Diagram

Save this as queue_batch.py next to the workflow file:

Python
import json, sys, urllib.request

wf = json.load(open("vorlux_flux_schnell_batch_api.json"))
for n, line in enumerate(open(sys.argv[1], encoding="utf-8")):
    name, prompt = line.strip().split(";", 1)
    wf["6"]["inputs"]["text"] = prompt
    wf["3"]["inputs"]["seed"] = 1000 + n            # fixed per product: rerun = same images
    wf["5"]["inputs"]["batch_size"] = 4             # four variants per product
    wf["9"]["inputs"]["filename_prefix"] = f"catalogue/{name}"
    req = urllib.request.Request("http://127.0.0.1:8188/prompt",
                                 data=json.dumps({"prompt": wf}).encode(),
                                 headers={"Content-Type": "application/json"})
    print(name, json.load(urllib.request.urlopen(req))["prompt_id"])

Run python3 queue_batch.py products.txt. Every line becomes one queued job; ComfyUI works through them in order and you can close the terminal. Twenty-five products at batch 4 give you a hundred images in output/catalogue/.

If it fails: Connection refused means the server is not on port 8188. A 400 reply quotes the node that broke, usually a model file name that does not match yours.

Seeds matter more than they look. We checked: the same seed gives pixel-identical images at batch 4 and at batch 8 (the first four of the eight). So you can preview with a small batch, then rerun a larger one, and the images you liked come back.

Four FLUX.1-schnell images from one batch-4 job, seed 42, generated on our DGX Spark

What we measured

Measured 2026-11-02 on our NVIDIA DGX Spark (GB10, 128 GB unified memory, driver 580.173.02, CUDA 13.0), ComfyUI 0.25.0, PyTorch 2.12.1+cu130. FLUX.1-schnell fp8, 1024×1024, 4 steps, CFG 1.0, one prompt, seeds 42 to 44. One discarded warm-up image first. Time is ComfyUI’s own start-to-finish timestamp for each job (/history/<prompt_id>).

Batch sizeSeconds per image (median)RangeSeconds per jobImages per minuteRuns
16.186.17 to 6.376.29.73
45.705.68 to 6.4322.810.53
86.095.97 to 6.2248.89.82

The first image after the model had been unloaded took 13.7 s, because that job also loads the 17.2 GB checkpoint. Keep the server running between batches.

The script is scripts/bench/comfyui_flux_batch.py and every reading, with the memory snapshots, is in comfyui-flux-batch-2026-11-02.json.

What the numbers say

Batching is not where the speed comes from on this box. Going from one image to four per job saved half a second per image, 8 %. Going to eight saved nothing.

Memory is the real limit. Batch 4 needed roughly 7 GB more than batch 1 (free -g, available memory 57 GB down to 50 GB). The first batch-4 job and both batch-8 jobs made the system reclaim cache, stalling it for 1.6 to 4 seconds (/proc/pressure/memory). On a desktop that shares memory with the GPU, those pauses can show up as a stuttering mouse; we did not check that in this run. Our script stopped batch 8 at two runs for that reason.

So the habit is: batch 4, many jobs in the queue, and one long-running server.

When not to do this

  • One hero image. Use the browser and change the seed by hand; a script is overhead.
  • Scenes with people, hands or readable text. Schnell is fast because it takes 4 steps. Check every image before it goes on a shop page.
  • Consistent angles across a range. Prompts alone drift. Add the edge-guided step from our ControlNet tutorial.
  • A small GPU and a big batch. We only measured the GB10. On a 12 GB card start at batch 1, watch memory, then raise it.

Next steps


Sources: FLUX.1 [schnell] model card · ComfyUI Flux examples · ComfyUI on GitHub

Work with us

We size the model and the machine by measuring, not by guessing. If you want to see your own task running on real hardware, book a 15-minute call or see how we work in consulting.

Diagram
Share: LinkedIn X
Veredicto semanal

Get new guides before anyone else

Subscribe and we tell you when new guides, templates and workflows go up. One email a week, no spam.

Already published: 91 guides and 25 templates. All free, no signup.

Bonus: the local-AI starter pack PDF when you subscribe
Once a week No spam Unsubscribe anytime

See what you get