This notebook shows how to generate synthetic image data with Data Designer using image-generation models.
Data Designer supports both diffusion (e.g. DALL·E, Stable Diffusion, Imagen) and autoregressive (e.g. Gemini image, GPT image) models.
Prerequisites: This tutorial uses OpenRouter with the Flux 2 Pro image model. Set
OPENROUTER_API_KEYin your environment before running.
If this is your first time using Data Designer, we recommend starting with the first notebook in this tutorial series.
data_designer.config provides the configuration API.DataDesigner is the main interface for generation.We initialize Data Designer without arguments here—the image model is configured explicitly in the next cell. No default text model is needed for this tutorial.
ImageInferenceParams so Data Designer treats this model as an image generator.extra_body.We'll generate diverse dog portrait images: sampler columns drive subject (breed), age, style, look direction, and emotion. The image-generation column uses a Jinja2 prompt that references all of them.
[21:20:32] [INFO] ✅ Validation passed
In preview mode, generated images are stored as base64 strings in the dataframe. Run the next cell to step through each record (images are shown in the sample record display, but only in a notebook environment).
[21:20:32] [INFO] 🔁 Preview generation in progress
[21:20:32] [INFO] |-- 🔒 Jinja rendering engine: secure
[21:20:32] [INFO] ✅ Validation passed
[21:20:32] [INFO] ⛓️ Sorting column configs into a Directed Acyclic Graph
[21:20:32] [INFO] 🩺 Running health checks for models...
[21:20:32] [INFO] |-- 👀 Checking 'black-forest-labs/flux.2-pro' in provider named 'openrouter' for model alias 'image-model'...
[21:20:43] [INFO] |-- ✅ Passed!
[21:20:43] [INFO] ⚡ DATA_DESIGNER_ASYNC_ENGINE is enabled - using async task-queue preview
[21:20:43] [INFO] 🖼️ image model config for column 'generated_image'
[21:20:43] [INFO] |-- model: 'black-forest-labs/flux.2-pro'
[21:20:43] [INFO] |-- model alias: 'image-model'
[21:20:43] [INFO] |-- model provider: 'openrouter'
[21:20:43] [INFO] |-- inference parameters:
[21:20:43] [INFO] | |-- generation_type=image
[21:20:43] [INFO] | |-- max_parallel_requests=4
[21:20:43] [INFO] | |-- extra_body={'height': 512, 'width': 512}[21:20:43] [INFO] ⚡️ Async generation: 1 column(s) (generated_image), 2 tasks across 1 row group(s)
[21:20:43] [INFO] 🚀 (1/1) Dispatching with 2 records
[21:20:43] [INFO] 🎲 (1/1) Preparing samplers to generate 2 records across 9 columns
[21:20:56] [INFO] 📊 Progress [13.2s]:
[21:20:56] [INFO] |-- 🚗 generated_image: 1/2 (50%) 0.1 rec/s
[21:20:57] [INFO] 📊 Progress [13.9s]:
[21:20:57] [INFO] |-- 🚀 generated_image: 2/2 (100%) 0.1 rec/s
[21:20:57] [INFO] ✅ Async generation complete [13.9s]: 2 ok, 0 failed across 1 column(s)
[21:20:57] [INFO] 📊 Model usage summary:
[21:20:57] [INFO] |-- model: black-forest-labs/flux.2-pro
[21:20:57] [INFO] |-- tokens: input=135, output=6144, total=6279, tps=453
[21:20:57] [INFO] |-- requests: success=2, failed=0, total=2, rpm=8
[21:20:57] [INFO] |-- images: total=2
[21:20:57] [INFO] 📐 Measuring dataset column statistics:
[21:20:57] [INFO] |-- 🎲 column: 'style'
[21:20:57] [INFO] |-- 🎲 column: 'dog_breed'
[21:20:57] [INFO] |-- 🎲 column: 'cat_breed'
[21:20:57] [INFO] |-- 🎲 column: 'dog_age'
[21:20:57] [INFO] |-- 🎲 column: 'cat_age'
[21:20:57] [INFO] |-- 🎲 column: 'dog_look_direction'
[21:20:57] [INFO] |-- 🎲 column: 'cat_look_direction'
[21:20:57] [INFO] |-- 🎲 column: 'dog_emotion'
[21:20:57] [INFO] |-- 🎲 column: 'cat_emotion'
[21:20:57] [INFO] |-- 🖼️ column: 'generated_image'
[21:20:57] [INFO] ☀️ Preview complete!
Generated Columns ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Name ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ style │ watercolor │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ dog_breed │ a Cocker Spaniel │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ cat_breed │ a Turkish Angora │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ dog_age │ 12-15 │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ cat_age │ 9-12 │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ dog_look_direction │ left │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ cat_look_direction │ up │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ dog_emotion │ serious │ ├─────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤ │ cat_emotion │ curious │ └─────────────────────────────────────────────────────────┴──────────────────────────────────────────────────┘ Images ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Name ┃ Preview ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ generated_image │ [0] <base64, 1935356 chars> │ └────────────────────────────────────────┴───────────────────────────────────────────────────────────────────┘
Generated Columns ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Name ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ style │ watercolor │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ dog_breed │ a Dachshund │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ cat_breed │ a Russian Blue │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ dog_age │ 12-15 │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ cat_age │ 3-6 │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ dog_look_direction │ front │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ cat_look_direction │ front │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ dog_emotion │ excited │ ├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤ │ cat_emotion │ sleepy │ └────────────────────────────────────────────────────────────┴───────────────────────────────────────────────┘ Images ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Name ┃ Preview ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ generated_image │ [0] <base64, 1968664 chars> │ └────────────────────────────────────────┴───────────────────────────────────────────────────────────────────┘
| style | dog_breed | cat_breed | dog_age | cat_age | dog_look_direction | cat_look_direction | dog_emotion | cat_emotion | generated_image | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | watercolor | a Cocker Spaniel | a Turkish Angora | 12-15 | 9-12 | left | up | serious | curious | [iVBORw0KGgoAAAANSUhEUgAABAAAAAMACAIAAAA12IJaA... |
| 1 | watercolor | a Dachshund | a Russian Blue | 12-15 | 3-6 | front | front | excited | sleepy | [iVBORw0KGgoAAAANSUhEUgAABAAAAAMACAIAAAA12IJaA... |
In create mode, images are written to an images/ folder with UUID filenames; the dataframe stores relative paths (e.g. images/1d16b6e2-562f-4f51-91e5-baaa999ea916.png).
[21:20:57] [INFO] 🎨 Creating Data Designer dataset
[21:20:57] [INFO] |-- 🔒 Jinja rendering engine: secure
[21:20:57] [INFO] ✅ Validation passed
[21:20:57] [INFO] ⛓️ Sorting column configs into a Directed Acyclic Graph
[21:20:57] [INFO] 🩺 Running health checks for models...
[21:20:57] [INFO] |-- 👀 Checking 'black-forest-labs/flux.2-pro' in provider named 'openrouter' for model alias 'image-model'...
[21:21:08] [INFO] |-- ✅ Passed!
[21:21:08] [INFO] ⚡ DATA_DESIGNER_ASYNC_ENGINE is enabled - using async task-queue builder
[21:21:08] [INFO] 🖼️ image model config for column 'generated_image'
[21:21:08] [INFO] |-- model: 'black-forest-labs/flux.2-pro'
[21:21:08] [INFO] |-- model alias: 'image-model'
[21:21:08] [INFO] |-- model provider: 'openrouter'
[21:21:08] [INFO] |-- inference parameters:
[21:21:08] [INFO] | |-- generation_type=image
[21:21:08] [INFO] | |-- max_parallel_requests=4
[21:21:08] [INFO] | |-- extra_body={'height': 512, 'width': 512}[21:21:08] [INFO] ⚡️ Async generation: 1 column(s) (generated_image), 2 tasks across 1 row group(s)
[21:21:08] [INFO] 🚀 (1/1) Dispatching with 2 records
[21:21:08] [INFO] 🎲 (1/1) Preparing samplers to generate 2 records across 9 columns
[21:21:20] [INFO] 📊 Progress [11.9s]:
[21:21:20] [INFO] |-- 😐 generated_image: 1/2 (50%) 0.1 rec/s
[21:21:21] [INFO] 📊 Progress [12.9s]:
[21:21:21] [INFO] |-- 🤩 generated_image: 2/2 (100%) 0.2 rec/s
[21:21:21] [INFO] ✅ Async generation complete [12.9s]: 2 ok, 0 failed across 1 column(s)
[21:21:21] [INFO] 📊 Model usage summary:
[21:21:21] [INFO] |-- model: black-forest-labs/flux.2-pro
[21:21:21] [INFO] |-- tokens: input=135, output=6144, total=6279, tps=479
[21:21:21] [INFO] |-- requests: success=2, failed=0, total=2, rpm=9
[21:21:21] [INFO] |-- images: total=2
[21:21:21] [INFO] 📐 Measuring dataset column statistics:
[21:21:21] [INFO] |-- 🎲 column: 'style'
[21:21:21] [INFO] |-- 🎲 column: 'dog_breed'
[21:21:21] [INFO] |-- 🎲 column: 'cat_breed'
[21:21:21] [INFO] |-- 🎲 column: 'dog_age'
[21:21:21] [INFO] |-- 🎲 column: 'cat_age'
[21:21:21] [INFO] |-- 🎲 column: 'dog_look_direction'
[21:21:21] [INFO] |-- 🎲 column: 'cat_look_direction'
[21:21:21] [INFO] |-- 🎲 column: 'dog_emotion'
[21:21:21] [INFO] |-- 🎲 column: 'cat_emotion'
[21:21:21] [INFO] |-- 🖼️ column: 'generated_image'
| style | dog_breed | cat_breed | dog_age | cat_age | dog_look_direction | cat_look_direction | dog_emotion | cat_emotion | generated_image | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | oil painting | a Labrador Retriever | a Balinese | 3-6 | 6-9 | front | down | excited | playful | ['images/generated_image/68b21d2f-9e49-4571-88... |
| 1 | anime | a Border Collie | a Norwegian Forest Cat | 3-6 | 6-9 | down | down | serious | aloof | ['images/generated_image/36126bd1-9f23-4fa5-b4... |