Image Optimisation with next/image

Hero image for Image Optimisation with next/image. Image by  Mohamed Nohassi.
Hero image for 'Image Optimisation with next/image.' Image by Mohamed Nohassi.

Images are one of the quickest ways to make a website feel slow, heavy, and visually unstable. They are also one of the hardest assets to ignore because the problems are easy for users to feel even when they cannot name them.

Pages jump while images load.

Mobile users download more pixels than they need.

Large hero images quietly dominate the payload.

That is why Next.js introducing next/image mattered. It took a familiar web performance problem and turned it into a firstclass framework concern rather than leaving every project to reinvent the same optimisation habits.

That tradeoff becomes much easier to take seriously on a contentheavy, imageled build. The Nando’s UK & Ireland Replatform is a good example: once you are dealing with large imagery across menus, campaigns, and editorial content, image discipline stops feeling optional.


A normal img tag leaves more work to the developer

There is nothing wrong with plain HTML images, but using them well requires discipline:

  • choose sensible sizes
  • avoid layout shifts
  • think about responsive behaviour
  • think about loading priority
  • optimise the assets beforehand

These are all still important with next/image, but the component gives us much better defaults and tooling around them.


The Basic Usage is Familiar

At a simple level:

import Image from 'next/image';const Hero = (): JSX.Element => {  return (    <Image      src="/images/hero.jpg"      alt="Mountain landscape"      width={1600}      height={900}    />  );};

The component still needs the essentials:

  • a source
  • alt text
  • dimensions

That dimension requirement is one of the most useful differences.


Width and Height Help Prevent Layout Shift

One of the most frustrating image problems on the web is content jumping down the page once an image finally appears.

If the browser does not know the image dimensions early enough, it cannot reserve the correct space.

next/image encourages us to provide width and height up front so layout can remain more stable. That is not just a technical nicety. It makes the page feel calmer and more deliberate.


Responsive Images Matter Because Users Do Not All Need the Same Asset

A huge desktop hero image should not necessarily be sent in the same form to a smaller mobile device.

This is one of the places where image optimisation becomes more than just compression. It is also about matching delivery to context.

Next.js helps by generating more appropriate image outputs and letting the browser choose more suitable sizes for the situation.

For example, a fullwidth hero usually wants sizes information so the browser can make a better choice:

import Image from 'next/image';const ArticleHero = (): JSX.Element => {  return (    <div style={{ position: 'relative', minHeight: '420px' }}>      <Image        src='/images/article-hero.jpg'        alt='Office workspace with multiple displays'        fill        priority        sizes='(max-width: 768px) 100vw, 80vw'        style={{ objectFit: 'cover' }}      />    </div>  );};

That example is doing a few useful things at once:

  • fill lets the image behave like a true layoutdriven hero
  • sizes tells the browser how much viewport width the image is likely to occupy
  • priority is reserved for an image that really matters to the first paint

Without that kind of hinting, it is much easier to ship an image that works visually but wastes bandwidth.


Lazy Loading is Another Practical Benefit

Images below the fold often do not need to load immediately.

If the user has not scrolled anywhere near them yet, loading them later can reduce the initial cost of the page. next/image helps with this sort of behaviour by default in a way that is much nicer than wiring up every image manually.

Again, the gain is not only theoretical. Less initial competition for network and rendering resources can make the page feel more responsive overall.


Not Every Image is Equally Important

This is another useful mindset that next/image encourages.

Some images are decorative and can wait.

Some are essential to the first impression of the page and deserve higher priority.

Good image optimisation is not only about shrinking files. It is about deciding which images matter to which moment in the user journey.


The Component Does Not Remove the Need for Judgement

It would be nice if a single framework component solved image performance entirely, but no component can fully substitute for good content decisions.

Teams still need to think about:

  • whether an image is too large conceptually
  • whether the crop makes sense
  • whether the alt text is useful
  • whether the page really needs all the imagery it contains

next/image improves delivery. It does not rescue weak image choices upstream.


It is Especially Useful on Content‑Heavy Pages

Blogs, editorial pages, category pages, and marketing pages often lean heavily on imagery. That means image performance can have a huge effect on:

  • first impressions
  • scrolling smoothness
  • perceived polish
  • mobile usability

This is why image optimisation is so often a meaningful part of frontend quality work rather than just a nice extra.


Better Defaults Reduce Repeated Mistakes

Frameworks are most helpful when they take a class of repeated performance mistakes and make the better approach easier than the worse one.

next/image fits that pattern well.

It nudges developers toward:

  • explicit dimensions
  • more responsive image delivery
  • safer lazyloading defaults
  • clearer image handling in the component layer

That does not guarantee a fast site, but it makes a good performance posture much more achievable.


Accessibility Still Matters Just as Much

Because the feature is performancefocused, it is easy to fixate on bytes and forget meaning.

The alt text still matters.

Decorative images should still be treated as decorative. Informative images should still be described meaningfully. A fast image that fails accessibility expectations is still a poor image implementation.


This is a Good Example of Framework‑Level Performance Help

For years, web performance advice around images was correct but repetitive:

  • resize them properly
  • avoid giant downloads
  • reserve layout space
  • lazy load where appropriate

next/image matters because it turns some of those concerns into a more structured development path rather than leaving every team to remember every rule manually.


Better Defaults Matter with Expensive Assets

Image optimisation with next/image is not only about a nicer component API. It is about making one of the web's heaviest asset types easier to handle responsibly. The component encourages better defaults around sizing, loading, and layout stability, which is exactly where image problems usually hurt users most.

That is why the feature is worth learning properly. Images are too expensive, and too visible, to leave them as an afterthought.


Categories:

  1. Development
  2. Front‑End Development
  3. Guides
  4. JavaScript
  5. Next.js
  6. Performance