Skip to content

next/image examples

The Image component resizes pictures, converts them to modern formats and lazy-loads them. Each card below shows one common setup.

Laptop with code on a white desk next to a monitor, a mug and headphones

1. Static import with priority

The file is imported, so Next.js knows its size and creates a blurred placeholder (placeholder="blur"). priority preloads it because it is at the top of the page.

Close-up of colourful source code on a dark editor screen

2. Fill a responsive box

With fill the image covers its parent (here a 16:9 box), and sizes tells the browser which width to download. It is lazy-loaded by default.

Source code on a monitor, loaded from Unsplash and shown in greyscale

3. Remote image

Images from another domain must be allowed in next.config.ts with images.remotePatterns. Width and height are required because Next.js cannot read the file at build time.

Next.js logo

4. Fixed-size SVG

Small logos and icons can use a fixed width and height. SVG files are served as they are, without resizing.

Photos from Unsplash.