Introduction
Cloudflare provides a platform for building and scaling media applications with Images. On this page, we'll answer the following questions:
- Why optimize images?
- How do I get started with Images?
- Should I store with Images or R2?
Loading images in their original resolution and format quickly becomes a bottleneck for app performance — especially on mobile.
Meanwhile, creating and storing multiple versions of the same image adds complexity and overhead, along with storage costs.
When you serve large amounts of media, image optimization provides:
- Streamlined infrastructure — Simplify your workflow and reduce infrastructure costs by dynamically generating optimized versions on request.
- Smaller file sizes — Automatically deliver images in modern formats like AVIF and WebP, which improves page speed and lowers bandwidth.
- Responsive sizing — Crop and resize for any use case, from square thumbnails to landscape banners, using the same original image in storage.
- Visual effects — Apply blur, overlays, background fills, and more at the edge.
There are two ways to use Images, depending on where your images are stored:
Keep your images on your own origin, in R2, or with any storage provider. Cloudflare pulls the original image, applies optimizations at the edge, and caches the optimized image.
You can define an origin allowlist to control which source images can be transformed on your zone.
To start, enable transformations on your zone.
Store, optimize, and deliver images globally with zero infrastructure management.
If your app centers around user-uploaded content, then you can use the Direct Creator Upload API to securely accept images directly from your users.
To start, set up predefined variants to configure how hosted images should be served.
Store in R2 and use Images for transformations if you want to build your own custom image pipeline or need fine-grained control over storage, such as bucket-level access management or object lifecycle rules. This is typically the most cost-effective approach for image optimization.
Store in Images if you want a fully managed solution with the least configuration. Our built-in features include a shared delivery domain, predefined variants, and automatic cache invalidation when you update original images in storage.
Each use case has a separate pricing model. To learn more, refer to Pricing.