
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYou're experiencing exactly what the Sanity image CDN is designed to do! Here's what's happening and how to optimize:
When you change query parameters (like rect, w, h, or auto=format), you're requesting a new image transformation that hasn't been generated yet. The first request has high TTFB because Sanity's Image Pipeline is:
After that initial request, the transformed image is cached at edge locations worldwide, so subsequent requests are lightning-fast.
According to Sanity's documentation on the Image Pipeline, the most important optimization is:
Limit the number of unique size/crop combinations you request. Instead of generating unique images for every viewport width, use a predefined srcset with a fixed set of image sizes.
Here's an example of a well-optimized approach:
<img
srcset="
https://cdn.sanity.io/images/.../image.png?w=320&h=320&auto=format 320w,
https://cdn.sanity.io/images/.../image.png?w=640&h=640&auto=format 640w,
https://cdn.sanity.io/images/.../image.png?w=960&h=960&auto=format 960w,
https://cdn.sanity.io/images/.../image.png?w=1280&h=1280&auto=format 1280w
"
sizes="(max-width: 768px) 100vw, 50vw"
/>Pre-warm critical images: If you know certain image transformations will be heavily used, you can request them during your build process to pre-populate the CDN cache
Use integer values: Non-integer values for w and h parameters can cause performance issues or timeouts
Leverage auto=format: This is great for automatically serving WebP/AVIF to supporting browsers, but note that AVIF transformations are generated asynchronously, so the first request might get WebP instead
Consider fit parameter carefully: Using fit=max prevents small images from being scaled up unnecessarily
Your current URL looks fine - the rect, w, h, and auto=format parameters are all standard. The "slowness" on first request is just the cost of on-demand image processing, which is actually a feature that saves you from pre-generating thousands of variants!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store