---
name: image-gen
description: Generate images with the user's own API keys (Google Gemini "Nano Banana" or OpenAI gpt-image). Use when asked to generate, create or make an image, illustration, icon, cut-out, sticker, thumbnail, texture, mockup or visual asset, to edit an image, or to make several images that stay consistent (same character or object). Also used by the vox-explainer skill for collage cut-outs.
title: image-gen
canonical_url: https://skilld.dev/gh/dotslashsimran/simcraft/image-gen
last_updated: 2026-11-12T02:34:47.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [scripts/gen_image.py](https://skilld.dev/api/skills-raw/dotslashsimran/simcraft/image-gen/scripts/gen_image.py).
>
> If the user asked to install this Skill, run `npx skilld install dotslashsimran/simcraft/image-gen`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/image-gen`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/dotslashsimran/simcraft/image-gen) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/image-gen`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/image-gen --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/image-gen --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Image gen

```
python3 ~/simcraft/skills/design/image-gen/scripts/gen_image.py "<prompt>" --out <dir> --name <name> [options]
```
Standard library only, so any `python3` works.

## Keys

The script reads `GEMINI_API_KEY` and `OPENAI_API_KEY` from the environment, or from `~/.config/simcraft/keys.env` (one `NAME=value` per line, chmod 600).
- Run `--check` to see which keys are set. It never prints a key.
- If no key is set, tell the user to open the file themselves (`open -e ~/.config/simcraft/keys.env`) and paste it in. Never ask them to paste a key into chat, and never read keys out of other projects' files.
- Keys go only in request headers. They never go in a URL, a log, or a sidecar file.
- Get a Gemini key at aistudio.google.com/apikey (it has a free tier). Get an OpenAI key at platform.openai.com/api-keys.

## Options

| Option | What it does |
|---|---|
| `--n 4` | Makes 4 variations in parallel, plus `<name>_sheet.png` to pick from. Use this for anything that matters. |
| `--aspect 16:9` | Sets the shape: 16:9, 9:16, 1:1, 4:3 or 3:4. Match it to where the image goes. |
| `--ref a.png b.png` | Reference images. Use them to edit an image, match a style, or keep the same character or object across images. |
| `--cutout` | Gives a transparent PNG for collages. Gemini generates on chroma green and the script keys it out with clean edges. OpenAI makes real transparency. |
| `--provider gemini\|openai` | Picks the provider. Default: Gemini if its key is set. |
| `--model M` | Picks the model. By default Gemini picks the newest image model the key can use (`--models` lists them), and OpenAI uses gpt-image-2. |
| `--quality low\|medium\|high` | OpenAI only. Default high. |
| `--brand devin` | Adds a brand kit's image style and palette to the prompt. **For any brand work, run the brand-kit skill first.** |

Every image gets a `<name>.json` sidecar with the exact prompt, model and settings, so it can be remade or tweaked later.

## Which provider

- **Gemini:** fast and cheap. Best for iterating, for edits, and for keeping things consistent with `--ref`.
- **OpenAI gpt-image:** best for images with text in them, and for true transparent cut-outs.

## Prompting

- Describe the subject, the medium, the light and the framing, in that order. Say what to leave out.
- **No text in images** unless the user asks for it. Models still misspell words. Add type afterwards in code.
- For a series, generate one anchor image first. Then pass that same anchor as `--ref` to every other image. Never chain image 2 into image 3, because small errors pile up.
- Show the user the contact sheet before using images anywhere. Regenerate one variation instead of all of them.
