---
title: "Cloudflare Images - Image Optimization & Delivery Platform"
description: "Streamlined image infrastructure built for scale. Global low-latency delivery, resizing, AI-powered optimization and background removal, and integrated with Cloudflare services for complete image workflows."
url: "https://www.cloudflare.com/products/images"
---

# Images

> Cloudflare Images helps teams build scalable, reliable media pipelines to store, optimize, and deliver images. Use Images to save time, engineering effort, and infrastructure costs.

## Key Features

- Automatic format conversion
- Responsive sizing
- Global CDN delivery
- Workers AI integration
- On-demand transformations
- WebP/AVIF support
- Image variants

## Benefits

### Global Low-Latency Delivery

Leverages Cloudflare's CDN to serve images fast, anywhere in the world with optimized formats and responsive sizing.

### Integrated with Cloudflare Services

Works seamlessly with Workers, Access, and other tools for full programmability and workflow control.

### AI-Powered Optimization

Automatically optimize images for different devices and formats, with AI-powered enhancements and transformations.

## Use Cases

### Deliver optimal formats

Automatically serve the most optimal format for the requesting browser (WebP, AVIF, JPEG) with intelligent format selection.

### AI image generation workflows

Optimize AI-generated images before storage or delivery — especially when using Workers and Workers AI for seamless integration.

### Multi-layered cache pipelines

Build cache-first media pipelines that check cache and R2 before transforming images on the fly for maximum efficiency.

### Responsive image delivery

Generate responsive images with srcset attributes, URL rewrites, and query parameters for perfect display across all devices.

## Code Examples

### Upload and optimize images

Upload images and serve them optimized with automatic format conversion and responsive sizing.

```typescript
export default {
  async fetch(request, env, ctx): Promise<Response> {
    // Upload an image
    const formData = new FormData();
    formData.append('file', imageFile);
    
    const uploadResponse = await fetch('https://api.cloudflare.com/client/v4/accounts/{account_id}/images/v1', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer ' + env.CLOUDFLARE_API_TOKEN,
      },
      body: formData,
    });
    
    const uploadResult = await uploadResponse.json();
    const imageId = uploadResult.result.id;
    
    // Serve optimized image
    const optimizedUrl = 'https://imagedelivery.net/' + env.DELIVERY_HASH + '/' + imageId + '/w=800,h=600,format=auto';
    
    return Response.redirect(optimizedUrl);
  },
};
```

### AI-Generated Image Optimization

Generate images with Workers AI and automatically optimize them for delivery. This example shows how to create an image with AI, store it in Images, and serve it with automatic format optimization.

```typescript
export default {
  async fetch(request, env) {
    // Generate image with Workers AI
    const imageResponse = await env.AI.run("@cf/lykon/dreamshaper-8-lcm", {
      prompt: "A beautiful sunset over mountains",
      num_steps: 4,
    });

    // Upload to Cloudflare Images
    const formData = new FormData();
    formData.append('file', imageResponse.image);
    
    const uploadResponse = await fetch('https://api.cloudflare.com/client/v4/accounts/{account_id}/images/v1', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer ' + env.CLOUDFLARE_API_TOKEN,
      },
      body: formData,
    });
    
    const uploadResult = await uploadResponse.json();
    const imageId = uploadResult.result.id;
    
    // Return optimized image URL
    const optimizedUrl = 'https://imagedelivery.net/' + env.DELIVERY_HASH + '/' + imageId + '/w=1200,h=800,format=auto,quality=85';
    
    return new Response(JSON.stringify({ 
      imageUrl: optimizedUrl,
      originalId: imageId 
    }), {
      headers: { "content-type": "application/json" },
    });
  },
} satisfies ExportedHandler;
```

## Resources

- [Full Documentation](https://developers.cloudflare.com/images): Complete technical documentation
- [Get Started](https://dash.cloudflare.com/sign-up): Sign up and start building
- [Pricing](/plans.md): See pricing details

## Related Products

- [RealtimeKit](/products/realtime.md): Live comms
- [Stream](/products/stream.md): Video streaming

---

*This is a markdown version of [https://www.cloudflare.com/products/images](https://www.cloudflare.com/products/images) for AI/LLM consumption.*
