> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Images

> Legacy DalleTools example that reads DALL-E image URLs from a run output.

<Warning>
  DALL-E models are deprecated. This `DalleTools` example is retained as a legacy reference and no longer runs against the current OpenAI API. Use `OpenAITools` with GPT Image 2 in [Image Generation Agent](/models/providers/native/openai/responses/usage/image-generation-agent).
</Warning>

## Code

```python generate_images.py theme={null}
from agno.agent import Agent, RunOutput
from agno.models.openai import OpenAIChat
from agno.tools.dalle import DalleTools

image_agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[DalleTools()],
    description="You are an AI agent that can generate images using DALL-E.",
    instructions="When the user asks you to create an image, use the `create_image` tool to create the image.",
    markdown=True,
)

image_agent.print_response("Generate an image of a white siamese cat")

# Retrieve and display generated images using get_last_run_output
run_response = image_agent.get_last_run_output()
if run_response and isinstance(run_response, RunOutput) and run_response.images:
    for image_response in run_response.images:
        image_url = image_response.url
        print(image_url)
else:
    print("No images found in run response")
```

## Current Alternative

The source above uses removed DALL-E models and is preserved for reference. Follow [Image Generation Agent](/models/providers/native/openai/responses/usage/image-generation-agent) to generate and save images with `OpenAITools` and GPT Image 2.
