A CLI tool for generating AI-powered coloring pages for kids using OpenAI's image generation API.
- Generate black and white line drawings perfect for coloring
- Export as PNG or PDF in A4 format
- Bold, clear outlines optimized for children
- Ready-to-print coloring pages
- Modular design for easy integration into web applications
uv syncexport OPENAI_API_KEY="your-openai-api-key"Build and run the web application using Podman:
# Build the container image
podman build -t colorcraft .
# Run the web application
podman run -p 5000:5000 -e OPENAI_API_KEY="your-openai-api-key" colorcraftThe web interface will be available at http://localhost:5000
You can also customize the configuration:
# Run with custom port and debug mode
podman run -p 8080:8080 \
-e OPENAI_API_KEY="your-openai-api-key" \
-e FLASK_PORT=8080 \
-e FLASK_DEBUG=true \
colorcraft# Generate a PNG coloring page
uv run python -m colorcraft "a cute cat playing with a ball"
# Generate a PDF coloring page
uv run python -m colorcraft "a dinosaur in a forest" --format pdf --output dinosaur_page
# Specify custom output filename
uv run python -m colorcraft "a princess castle" --output my_castle --format pngprompt(required): Text description of what you want in the coloring page--output, -o: Output filename without extension (default: "coloring_page")--format, -f: Output format, either "png" or "pdf" (default: "png")--api-key: OpenAI API key (can also be set via OPENAI_API_KEY environment variable)
# Simple animal coloring page
uv run python -m colorcraft "a friendly elephant"
# More detailed scene
uv run python -m colorcraft "children playing in a playground with swings and slides" --format pdf
# Fantasy theme
uv run python -m colorcraft "a magical unicorn with rainbow mane" --output unicorn_magicAll generated images are:
- Optimized for A4 paper size
- High contrast black and white line art
- Bold outlines (2-3px thick) perfect for coloring
- Clean, simple designs suitable for children
- Ready to print at 300 DPI
- Python 3.13+
- OpenAI API key
- Internet connection for API calls
requests: For OpenAI API communicationPillow: For image processingreportlab: For PDF generationclick: For CLI interface
This project was developed using aider, an AI pair programming tool.