← chapter

Image generation

Chapter 13 · the model makes pictures now

The hour

The whole API

def generate(prompt, path):
    r = client.images.generate(
        model="gpt-image-1", prompt=prompt, size="1024x1024")
    data = base64.b64decode(r.data[0].b64_json)
    open(path, "wb").write(data)

No conversation. What you iterate on is the prompt.

Specificity is everything

Vague in → generic out.

Add: "soft watercolor," "dramatic rim lighting," "isometric," "shot on 35mm film."

The vocabulary of art direction is the vocabulary that works.

Put it to work — three apps

Same generate call; the prompt template + size change.

The productization move

_STYLE = "A die-cut sticker of {subject}. Bold outline, flat colors, white bg."

User brings the subject; app brings the look. Most real image features are exactly this.

Before you ship

Takeaway

One-shot call; the skill is all prompt + parameters. Template a house style, choose aspect ratio on purpose, budget for the cost. Next: audio, both directions.