generate_image
Generate images from text prompts and save them to disk. Create UI mockups, icons, diagrams, illustrations, or marketing graphics with in-image text.
Instructions
Generate image(s) from a text prompt with OpenAI GPT Image and save them to disk.
Use this to create new images from scratch: UI mockups, icons, hero images, diagrams, illustrations, and social/marketing graphics. GPT Image renders in-image text unusually well, so write any text you want to appear in the image literally and describe its placement.
Args: prompt: What to generate. Be specific about subject, style, composition, lighting, and any text that should appear in the image. model: GPT Image model. Default "gpt-image-2" (best quality + reasoning). Use "gpt-image-1-mini" for cheap/fast iteration, then re-render the final asset with "gpt-image-2". size: "1024x1024" (square), "1536x1024" (landscape), "1024x1536" (portrait), or "auto". gpt-image-2 also supports larger / 2K sizes. quality: "low", "medium", "high", or "auto". Higher is better and costs more. n: Number of images to generate (1-10). background: "auto", "opaque", or "transparent". NOTE: gpt-image-2 does NOT support "transparent" — pass model="gpt-image-1.5" (or another alpha-capable model) when you need a transparent background. output_format: "png", "jpeg", or "webp". output_dir: Directory to save images into. Defaults to $IMAGE_OUTPUT_DIR, or ./generated-images relative to the current working directory. filename: Base filename without extension. Defaults to a slug of the prompt plus a timestamp.
Returns: A text summary with the saved file path(s), followed by the image(s) inline.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | ||
| size | No | 1024x1024 | |
| model | No | gpt-image-2 | |
| prompt | Yes | ||
| quality | No | high | |
| filename | No | ||
| background | No | auto | |
| output_dir | No | ||
| output_format | No | png |