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 is OpenAI's mature image model — robust, consistent, and well-documented. GPT-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.
Python: `from openai import OpenAI; client = OpenAI(); response = client.images.generate(model='dall-e-3', prompt='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.
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.
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.
GPT-4o can analyse images, documents, charts, and screenshots in detail. This guide covers sending images via URL and base64, practical use cases, and building an image analysis pipeline.
Read guideWhisper is OpenAI's speech recognition model that supports 99 languages with near-human accuracy. This guide covers the Whisper API, running Whisper locally for privacy, and building a transcription pipeline for long recordings.
Read guideTraditional RAG ignores charts, diagrams, and images embedded in documents. Multimodal RAG retrieves and reasons over both text and visual content. This guide covers document parsing, image embedding, and hybrid retrieval.
Read guide