CloudFlare R2 and image optimization (size/format)


I’m exploring the tools Cloudflare R2 and Images.
I’ve done some testing consuming the APIs to upload objects or Images using Cloudflare R2.
I need to see how we can optimize Image Sizes and format Stored on Cloudflare R2.

However, I could not locate any API under R2, and I am unsure if we can consume image optimization for R2 Images.

Here is the sample image I have uploaded on R2.

Can you please share thoughts about how I can achieve image optimization for the images uploaded on R2 buckets?


R2 is just an object storage bucket. It doesn’t offer such transformations natively, so there’s no “missing” API documentation.

Cloudflare Images will let you store, transform, optimize, and deliver images… so that might be the better product to use: Cloudflare Image Optimization · Cloudflare Image Optimization docs.

If you prefer to have your images in R2, you can use Cloudflare Image’s Transformations component to optimize, resize and convert any publicly available image. Transform images · Cloudflare Image Optimization docs