Generate coloring page images using the configured image renderer (set via IMAGE_RENDERER in .env). USE WHEN user says 'generate coloring pages', 'create coloring images', 'generate images for book', 'run image generation', 'kdp generate images', 'make coloring page images', 'generate pages from plan'.
Generates coloring book page images using the configured image renderer (from IMAGE_RENDERER in .env). Supported renderers: ai33, bimai, nanopic. This is the ONLY step that calls an external API — for image generation only, not prompt writing.
kdp-prompt-writer skill)/project:kdp-create-book command reaches the generation phaseCheck that:
output/{theme_key}/plan.json.env has IMAGE_RENDERER set (e.g. bimai, ai33, or nanopic) and the corresponding API key (BIMAI_API_KEY, AI33_KEY, or )NANOPIC_API_KEYpip install Pillow python-dotenv requestsls output/{theme_key}/plan.json
Plan-based (recommended):
python generate_images.py --plan output/{theme_key}/plan.json --count {num_pages}
The script auto-detects page_size from the plan JSON ("8.5x11" or "8.5x8.5"). For 8.5x8.5, images are generated with 1:1 (square) aspect ratio. You can override with --size 8.5x8.5.
Theme-based (legacy, for existing themes in config.py):
python generate_images.py --theme {theme_key} --count {num_pages}
Resume from a specific page:
python generate_images.py --plan output/{theme_key}/plan.json --count {num_pages} --start {start_index}
The script outputs:
[page_num/total] Generating: {prompt_preview}...Saved: page_XX.png on successFAILED: Could not generate image on failureNote failed pages for regeneration.
If pages fail:
--start at the failed indexls -la output/{theme_key}/images/
Check:
page_XX.png files existIMAGE_RENDERER in .env (supports: ai33, bimai, nanopic).env (AI33_KEY, BIMAI_API_KEY, or NANOPIC_API_KEY)--renderer flag to override the .env defaultPage sizes (--size):
| Size | Dimensions | Aspect Ratio | Pixels (300 DPI) |
|---|---|---|---|
8.5x11 (default) | 8.5" x 11" portrait | 3:4 | 2550 x 3300 |
8.5x8.5 | 8.5" x 8.5" square | 1:1 | 2550 x 2550 |
output/{theme_key}/images/page_01.png through page_XX.png