Show HN: Command-Line Batch Image Generator (Supports Lazy Text, OpenAI Image 1)

github.com

1 points by markmatsushima a day ago

Hi HN,

I built a Python command-line tool to batch-generate images using OpenAI's new GPT Image 1 model.

Just drop instruction files (either plain text or JSON) into the image_prompts/ folder, then run: python generate.py

- You can write multiple prompts and even request multiple images per prompt (e.g. n=5)

- On first run, the script will ask for your OpenAI API key and store it in .env.local

- Output images and their associated structured JSON files are saved to the images/ folder

I originally made this for my own website. I found ChatGPT's image generation too slow for batch work: downloading files one by one and typing prompts manually didn’t scale.

I first wrote a version that accepted only JSON (strict.py), but quickly realized how error-prone it was to hand-edit JSON: missing commas, quotes, or bad line breaks.

So I added a “lazy” mode (generate.py) using gpt-4o-mini. It parses free-form text or broken JSON into valid, structured prompts behind the scenes.

Thanks for checking it out!