Skip to content
Codex DesignBETA

How to generate images in Codex.

Yes, Codex can generate images. You can create UI assets, illustrations, icons, backgrounds, and mockups in the same conversation where Codex writes your code, and edit them with follow-up prompts. This guide covers how it works in the desktop app, the CLI, and the IDE extension, how image generation counts toward your limits, and what to check when it doesn’t work.

Updated November 6, 2026 · 6 min read

How to generate an image in Codex

Describe the image you want in plain words. To call image generation explicitly, include $imagegen in your prompt. Add a reference image when you want Codex to edit an existing asset or use it as visual guidance.

  • ChatGPT desktop app (Codex): ask in the composer and attach a reference image if you have one. Select a generated image to open it: Focused view shows one image, and Canvas view shows every image from the conversation. In Canvas view, use Comment to leave feedback on one or more images, or Multi-select to pick several and send your changes together.
  • Codex CLI: describe the image in an interactive session or include $imagegen. Attach an existing image with -i or --image.
  • IDE extension: ask in the extension chat. To add a reference image, drag it into the composer while holding Shift.
A UI asset
$imagegen Create an empty-state illustration for a budgeting app: a small potted plant next to a stack of coins on a plain warm-white background. Flat shapes, two colors only, deep green and soft coral, no outlines. Square, with generous empty space around the subject. No text.

Write prompts that work

OpenAI recommends one to three clear sentences that cover what decides whether the image succeeds:

  1. What it’s for, such as an app’s empty state, a blog header, or an onboarding screen.
  2. The subject and what is happening.
  3. Composition and style: framing, size, colors, lighting, and materials when they matter.
  4. Constraints, including anything the image must not contain.

Use concrete visual language instead of reactions: “soft daylight from the left” works better than “beautiful lighting.” If something must stay fixed, say so again.

Edit an image you already have

Say exactly what should change and what must stay the same, and change one thing at a time so the rest doesn’t drift.

Change one element
Edit the attached image. Replace only the coins with a small calculator. Keep the plant, the colors, the background, the crop, and everything else exactly the same. Do not add text.
  • Several reference images: refer to them by order, for example “image 1 is the screenshot to edit, image 2 is the style reference,” and say what to take from each.
  • Text in the image: put the exact words in quotation marks, describe the font style, size, color, and placement, and say whether any other text is allowed. Check every word of dense or important text yourself.

How image generation counts toward your limits

  • Plans: image generation isn’t available on the Free plan. It is available on Plus, Pro, Business, Enterprise, and Edu, and with an API key.
  • Usage: image generation counts toward the same limits as your other Codex work, and uses your included limits about 3–5 times faster on average than similar turns without images, depending on quality and size.
  • After the limit: generation draws from credits if you have them.
  • With an API key: API pricing applies instead of your plan’s limits. For large batches, OpenAI suggests setting OPENAI_API_KEY and asking Codex to generate the images through the API.

Codex’s documentation says built-in image generation uses gpt-image-2. OpenAI announced GPT Image 2.6 for ChatGPT and Codex on November 4, 2026; see GPT Image 2.6 for UI design for what changed.

See Codex pricing for plan prices and how limits reset.

When image generation doesn’t work

  • You’re on the Free plan. Image generation isn’t included; you need Plus or above, or an API key.
  • You hit your limit. Wait for it to reset, buy credits on Plus or Pro, or use an API key.
  • The CLI never generates an image. Run codex features list and check that image_generation is true. If it isn’t, turn it back on with codex features enable image_generation.
  • You’re on a work or school workspace. Admins control which features members can use, so ask yours whether image generation is turned on for you.
  • The result ignores part of your prompt. Shorten the prompt, repeat the requirement that matters most, and change one thing per follow-up.

Use generated images for UI design

Image generation is fastest for exploring how a screen could look, and for assets such as illustrations, icons, and backgrounds. For screens you will build, a common workflow is: generate two or three mockup images, pick a direction, then ask Codex to rebuild it as HTML, so you can edit the real text, spacing, and colors. The GPT Image 2.6 prompts include app screens, websites, dashboards, and icons to start from.

Frequently asked questions

Can Codex generate images?

Yes. Codex can generate and edit images in the ChatGPT desktop app, the Codex CLI, and the IDE extension, on Plus and higher plans or with an API key.

What does $imagegen do?

It calls Codex’s image generation skill explicitly. Describing the image in plain words usually works too; $imagegen removes any doubt about which tool Codex should use.

Where does Codex save generated images?

In the app, generated images appear in the conversation and its image viewer. In our setup, the CLI kept them in a generated_images folder inside Codex’s home folder (~/.codex by default). Ask Codex to move the image you want into your project, for example into public/images.

Keep reading

An independent plugin for Codex. Not affiliated with or endorsed by OpenAI.