How to generate images with DALL-E 3 and GPT-Image-1

OpenAI's image generation models produce high-quality images from text descriptions. This guide covers the Images API, prompt writing for consistent results, using the edit endpoint, and integrating image generation into applications.

DALL-E 3 vs GPT-Image-1

DALL-E 3 is OpenAI's mature image model — robust, consistent, and well-documented. GPTGPTGenerative Pre-trained Transformer — the model architecture and family name behind OpenAI's most famous models, from GPT-2 to GPT-5.Learn more →-Image-1 is newer and produces higher quality results, particularly for text within images, photorealistic scenes, and complex compositions. GPT-Image-1 supports image editing and inpainting; DALL-E 3 does not.

For most applications, DALL-E 3 is the practical choice: it is well-tested, has predictable output quality, and integrates natively with ChatGPT-style flows. Use GPT-Image-1 when you need the highest quality output or editing capabilities.

Generate your first image

Python: `from openai import OpenAI; client = OpenAI(); response = client.images.generate(model='dall-e-3', promptPromptThe input text sent to a language model — the question, instruction, or context that triggers a response.Learn more →='A photorealistic image of a fox sitting in a snowy forest at sunset, volumetric lighting, 8k', size='1024x1024', quality='hd', n=1); image_url = response.data[0].url`.

DALL-E 3 supports sizes: `1024x1024`, `1792x1024` (landscape), `1024x1792` (portrait). Quality: `standard` or `hd`. HD mode applies more processing passes for higher detail at ~2× the cost. The response includes a `revised_prompt` — DALL-E 3 sometimes rewrites your prompt; log this to understand what the model is actually generating.

Write effective prompts

DALL-E 3 understands natural language well — you do not need to use comma-separated keyword lists. Write full sentences describing what you want: subject, style, lighting, camera angle, colour palette, and mood. The model follows detailed descriptions accurately.

For consistent results across multiple images, describe the visual style explicitly: 'watercolour illustration with loose brushstrokes', 'photorealistic, shot with a 50mm lens, shallow depth of field', or 'flat vector illustration in a minimal Scandinavian style'. Reusing the exact style description across prompts gives visual consistency in image sets.

Edit images with GPT-Image-1

GPT-Image-1 supports inpainting — editing specific regions of an existing image. Provide the original image and a mask (PNG with transparent regions indicating what to replace): `response = client.images.edit(model='gpt-image-1', image=open('original.png', 'rb'), mask=open('mask.png', 'rb'), prompt='Replace the background with a tropical beach')`. Only the masked region is regenerated.

For product photography, generate a clean product image against a white background, then use the edit endpoint to place it in different scenes: 'A dining table in a modern Scandinavian kitchen', 'An outdoor cafe table in Paris'. This is far cheaper than multiple photo shoots.