Contentstack Image Delivery: Fast, Responsive Images Through URL Parameters

Images are usually the heaviest part of a page

A 4 MB hero image uploaded by an editor can ruin your Core Web Vitals. The Image Delivery API lets you transform images on the fly using URL parameters — no extra image service required.

Common Parameters

https://images.contentstack.io/v3/assets/.../hero.jpg?width=1200&quality=75&format=webp
  • width, height — resize
  • fit=crop / fit=bounds — crop or fit within dimensions
  • format=webp / format=avif / auto=webp — modern formats
  • quality — compression level
  • crop and trim — select regions
  • dpr — device pixel ratio for retina screens

Responsive Images

<img
  src="hero.jpg?width=800&auto=webp"
  srcset="hero.jpg?width=400&auto=webp 400w,
          hero.jpg?width=800&auto=webp 800w,
          hero.jpg?width=1600&auto=webp 1600w"
  sizes="(max-width: 768px) 100vw, 800px"
  alt="..."
  loading="lazy"
/>

In Next.js

Use a custom loader with next/image so Next.js generates URLs with Contentstack parameters:

const contentstackLoader = ({ src, width, quality }) =>
  `${src}?width=${width}&quality=${quality || 75}&auto=webp`;

Best Practices

  • Never serve original uploads directly
  • Always set width and height to avoid layout shift
  • Lazy-load below-the-fold images
  • Require alt text in your content model

Image optimisation is the cheapest performance win in most sites — and with URL parameters, it's nearly free.

Arivanandhan Chitheshwaran