6.5 Image Generation (gpt-image; DALL-E 3 Retired)
Key Takeaways
Azure OpenAI generates images with the gpt-image series through the Images API; dall-e-3 was retired on March 4, 2026, and dall-e-2 on January 27, 2025.
GPT-Image-1 supports sizes 1024x1024, 1024x1536, and 1536x1024, quality low, medium, or high (default high), and 1-10 images per request with the n parameter.
GPT-Image-1, GPT-Image-1-Mini, GPT-Image-1.5 and GPT-Image-2 return images only as base64 (b64_json), not URLs, and gpt-image models support editing (inpainting) with an input image, a mask, and a prompt.
Content filtering runs on BOTH the input prompt and the generated image, using the same harm categories (hate, sexual, violence, self-harm) as text.
A blocked prompt returns the error code contentFilter, and a blocked output returns "Generated image was filtered as a result of our safety system"; handle both without crashing.
Retired: The AI-102 outline still says "Use the DALL-E model to generate images", but Microsoft retired dall-e-3 in Azure OpenAI on March 4, 2026 (existing deployments stop working) and dall-e-2 on January 27, 2025. Current image generation uses the gpt-image series.
Quick Answer: Azure OpenAI creates images via the Images API with a gpt-image model. GPT-Image-1 supports 1024x1024, 1024x1536, 1536x1024,
qualitylow/medium/high (default high), and 1-10 images per call withn. Output is base64 only (b64_json, no URL). gpt-image models also edit images with a mask. Content filters screen both the prompt and the output image.
Generating an Image
import base64
from openai import AzureOpenAI
client = AzureOpenAI(api_version="2025-04-01-preview",
azure_endpoint="https://my-openai.openai.azure.com/",
azure_ad_token_provider=token_provider)
resp = client.images.generate(
model="gpt-image-1", # deployment name
prompt="A serene mountain lake at sunset, digital art",
n=1, # 1-10 images per request
size="1024x1024", # or 1024x1536 / 1536x1024
quality="high" # low, medium, or high (default high)
)
image_b64 = resp.data[0].b64_json # base64 only; no URL option
with open("lake.png", "wb") as f:
f.write(base64.b64decode(image_b64))
On the Exam: GPT-Image-1 (like 1-Mini, 1.5 and 2) returns base64 image data, so your code decodes and stores the bytes (for example in Blob Storage); there is no temporary URL to persist.
gpt-image Models at a Glance
| Model | Availability | Sizes | Quality | Images per request |
|---|---|---|---|---|
| GPT-Image-1 | Limited access preview | 1024x1024, 1024x1536, 1536x1024 | low, medium, high (default high) | 1-10 (n) |
| GPT-Image-1-Mini | Limited access preview | Same three sizes | low, medium, high (default medium) | 1-10 |
| GPT-Image-1.5 | Limited access preview | Same three sizes | low, medium, high (default high) | 1-10 |
| GPT-Image-2 | Generally available | Custom sizes: both edges multiples of 16 px, long edge up to 3,840 px | low, medium, high | 1-10 |
GPT-Image-2.5 models are also generally available. Trap: 256x256 and 512x512 were DALL-E 2 sizes, and 1792x1024 / 1024x1792 were DALL-E 3 sizes; both models are retired. The one-image-per-request limit was also a DALL-E 3 rule, while gpt-image models accept n from 1 to 10.
Editing with a Mask
gpt-image models accept text and image inputs. The edits endpoint takes an input image, a prompt, and an optional mask that marks the region to change; the mask must be the same size as the input image. This inpainting is the answer whenever a scenario edits part of an existing photo.
Dual Content Filtering
The Image APIs come with a content moderation filter that is applied twice:
| Stage | When | Result when blocked |
|---|---|---|
| Prompt filter | Before generation | No image is generated; the error code is contentFilter |
| Image filter | After generation | The error message says "Generated image was filtered as a result of our safety system." |
Both filters use the same four harm categories as text — hate, sexual, violence, self-harm — at configurable severity. A prompt may pass yet still have its output blocked.
Handling a blocked request
When a request is blocked, you do not get a usable image. Your application must handle this gracefully — show a friendly message and let the user revise the prompt rather than silently failing. Defensive code should anticipate a block at either the prompt or the image stage, not just on submission.
Persisting generated images
Because GPT-Image-1, 1-Mini, 1.5 and 2 return base64 data, production apps decode the bytes and store them in durable storage such as Azure Blob Storage with their own access controls. To get several variations, set n (up to 10) instead of looping.
Historical: DALL-E 3
Older study material and the AI-102 outline describe DALL-E 3: sizes 1024x1024, 1792x1024 and 1024x1792, one image per request, quality standard/hd, style vivid/natural, a temporary URL, and an automatic revised_prompt. Those parameters belong to a model Microsoft retired on March 4, 2026, so don't treat them as current answers.
On the Exam: Remember the dual filter (prompt AND image), the gpt-image sizes and
nrange, base64-only output, and mask-based editing. If an item still offers DALL-E 3, treat it as the retired model; the current Azure OpenAI image models are the gpt-image series.
Which image sizes does gpt-image-1 support on Azure OpenAI?
256x256, 512x512, 1024x1024
1024x1024, 1024x1536, 1536x1024
1024x1024, 1792x1024, 1024x1792
Any custom size up to 4096x4096
How does gpt-image-1 in Azure OpenAI return the generated image?
As a temporary URL that expires after about 24 hours
As a link to a Blob Storage container the service creates
As base64-encoded image data in the b64_json field
As an SVG vector file
How does content filtering apply to image generation on Azure OpenAI?
Only the input prompt is filtered
Only the generated image is filtered
Both the input prompt and the generated image are filtered
Filtering is disabled for image models
An application must edit an existing photo by replacing a masked region with new content. Which model is appropriate?
DALL-E 3, using the style=natural parameter
GPT-image-1, which supports image editing and inpainting with a mask
Whisper
text-embedding-3-large
Sections you finish are checked off in the contents.