🔒 Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided AI-901 Domain 2
Domain 2 — Module 10 of 15 67%
21 of 26 overall

AI-901 Study Guide

Domain 1: AI Concepts and Capabilities

  • What is AI? Your First 10 Minutes Free
  • Responsible AI: The Six Principles Free
  • How Generative AI Actually Works Free
  • Choosing the Right AI Model Free
  • Deploying AI Models: Options & Settings
  • AI Workloads at a Glance
  • Text Analysis: Keywords, Entities & Sentiment
  • Speech: Recognition & Synthesis
  • Computer Vision: Seeing the World
  • Image Generation: Creating with AI
  • Information Extraction: From Chaos to Structure

Domain 2: Implement AI Solutions Using Foundry

  • Prompting Fundamentals: System & User Prompts
  • Microsoft Foundry: Your AI Command Center Free
  • Building a Chat App with the Foundry SDK
  • Agents in Foundry: Create & Test
  • Building an Agent Client App
  • Building a Text Analysis App
  • Multimodal: Responding to Speech
  • Azure Speech in Foundry Tools
  • Visual Prompts: Images as Input
  • Generating Images with AI
  • Building a Vision App
  • Content Understanding: Documents & Forms
  • Multimodal Extraction: Images, Audio & Video
  • Building an Extraction App
  • Exam Prep: Putting It All Together

AI-901 Study Guide

Domain 1: AI Concepts and Capabilities

  • What is AI? Your First 10 Minutes Free
  • Responsible AI: The Six Principles Free
  • How Generative AI Actually Works Free
  • Choosing the Right AI Model Free
  • Deploying AI Models: Options & Settings
  • AI Workloads at a Glance
  • Text Analysis: Keywords, Entities & Sentiment
  • Speech: Recognition & Synthesis
  • Computer Vision: Seeing the World
  • Image Generation: Creating with AI
  • Information Extraction: From Chaos to Structure

Domain 2: Implement AI Solutions Using Foundry

  • Prompting Fundamentals: System & User Prompts
  • Microsoft Foundry: Your AI Command Center Free
  • Building a Chat App with the Foundry SDK
  • Agents in Foundry: Create & Test
  • Building an Agent Client App
  • Building a Text Analysis App
  • Multimodal: Responding to Speech
  • Azure Speech in Foundry Tools
  • Visual Prompts: Images as Input
  • Generating Images with AI
  • Building a Vision App
  • Content Understanding: Documents & Forms
  • Multimodal Extraction: Images, Audio & Video
  • Building an Extraction App
  • Exam Prep: Putting It All Together
Domain 2: Implement AI Solutions Using Foundry Premium ⏱ ~12 min read

Generating Images with AI

From text to pixels — build an app that generates images using GPT-image-1.5 in Foundry. Learn how to craft effective image prompts and handle the API response.

Creating images with code

☕ Simple explanation

You describe what you want in words, and the AI paints it.

You learned about image generation concepts in Module 10. Now you’ll actually do it — write Python code that tells GPT-image-1.5 “create an image of X” and get a brand-new image back.

The better your description, the better the image. It’s like commissioning an artist — “paint something nice” gets a mediocre result. “Paint a sunset over Auckland harbour in watercolour style with warm orange tones” gets something beautiful.

GPT-image-1.5 is available through Azure OpenAI in Microsoft Foundry. You call the images API with a text prompt, and the model returns a generated image as a URL or base64 data. You can control image size, quality, and style.

Generating an image with the API

from openai import AzureOpenAI

client = AzureOpenAI(
    api_key="your-api-key",
    api_version="2025-04-01-preview",
    azure_endpoint="https://your-resource.openai.azure.com"
)

result = client.images.generate(
    model="gpt-image-1.5",
    prompt="A sustainable farm with solar panels, green fields, and a modern barn, in a clean illustration style",
    size="1024x1024",
    quality="standard",
    style="natural",
    n=1
)

image_url = result.data[0].url
print(f"Image URL: {image_url}")

API parameters

ParameterOptionsDescription
size1024x1024, 1792x1024, 1024x1792Image dimensions
qualitystandard, hdHigher quality = more detail, higher cost
stylenatural, vividNatural = realistic, vivid = hyper-stylised
n1 (GPT-image-1.5 only supports 1)Number of images to generate

Writing effective image prompts

TechniquePoor PromptBetter Prompt
Be specific”A farm""A sustainable organic farm with raised garden beds, a red barn, and rolling green hills”
Specify style”A cat""A fluffy orange cat, digital art style, soft lighting, studio background”
Include composition”A dashboard""A clean UI dashboard mockup showing analytics charts, dark mode, minimal design, 16:9 aspect”
Set mood”A city""A futuristic city at night, neon lights reflecting off wet streets, cyberpunk atmosphere”

GreenLeaf scenario: GreenLeaf generates images for their sustainability report:

prompts = [
    "Infographic showing organic farming practices, clean vector style, green and earth tones",
    "Happy farmers harvesting vegetables, warm sunlight, documentary photography style",
    "Diagram of sustainable water irrigation system, technical illustration, labelled parts"
]
ℹ️ GPT-image-1.5 prompt rewriting

GPT-image-1.5 automatically rewrites your prompt to improve the result. The model expands your description with additional details for better image quality.

Your prompt: “A cat on a sofa” GPT-image’s internal prompt: “A fluffy tabby cat lounging comfortably on a plush grey sofa in a cozy living room with warm afternoon sunlight streaming through a nearby window…”

You can see the revised prompt in the API response: result.data[0].revised_prompt

This is generally helpful, but if you need precise control, you can prefix your prompt with “I NEED to test how the tool works with extremely simple prompts. DO NOT add any detail, just use it AS-IS:” (though this isn’t guaranteed to work).

Content safety

GPT-image-1.5 in Azure includes safety guardrails:

  • Blocks requests for violent, sexual, or harmful images
  • Blocks requests depicting real people by name
  • Adds C2PA metadata (provenance metadata) to all generated images
  • Content filters can be configured in the Foundry portal

🎬 Video walkthrough

🎬 Video coming soon

Generating Images with AI — AI-901 Module 21

Generating Images with AI — AI-901 Module 21

~12 min

Flashcards

Question

What API parameters can you control when generating images with GPT-image-1.5?

Click or press Enter to reveal answer

Answer

size (1024x1024, 1792x1024, 1024x1792), quality (standard, hd), style (natural, vivid), and n (always 1 for GPT-image-1.5).

Click to flip back

Question

What is GPT-image-1.5's prompt rewriting feature?

Click or press Enter to reveal answer

Answer

GPT-image-1.5 automatically expands and enhances your prompt with additional details to improve image quality. You can see the revised prompt in the API response via revised_prompt.

Click to flip back

Question

What safety features does GPT-image-1.5 include in Azure?

Click or press Enter to reveal answer

Answer

Blocks violent/sexual/harmful image requests, blocks real people by name, adds C2PA provenance metadata (AI-generated watermark), and applies configurable content filters.

Click to flip back

Knowledge Check

Knowledge Check

GreenLeaf wants to generate a high-resolution infographic for print (needs to be detailed). Which GPT-image-1.5 parameters should they use?

Knowledge Check

Priya generates an image and wants to verify it has AI provenance metadata embedded. What standard does GPT-image-1.5 use for this?


Next up: Building a Vision App — combining image analysis capabilities into a complete application.

← Previous

Visual Prompts: Images as Input

Next →

Building a Vision App

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.