Next.js Image Optimization Beyond next/image
Author
Brandon Cade
Date Published
Next.js gives you one of the best image primitives in the frontend ecosystem. The next/image component sizes correctly, serves modern formats, lazy-loads what should be lazy, and reserves layout space so nothing jumps. For most teams it turns a hard problem into an import.
What it does not do, and was never designed to do, is decide how much quality each individual asset needs. It exposes a single quality prop, you pick a number, and that number gets stamped onto every image the component ever touches.
That single number is where Largest Contentful Paint quietly goes wrong, and it is not a flaw in the component. It is a decision the component was never meant to make.
Key Takeaways
next/imagehandles sizing, format negotiation, and lazy-loading well. It does not decide per-asset quality.- Images are commonly 40 to 60% of page weight and the most frequent Largest Contentful Paint element on the web.
- One
qualityvalue across a whole site over-compresses detailed heroes and under-compresses flat graphics at the same time.- The missing layer is per-asset perceptual optimization in the publishing flow, verified against a structural similarity floor before anything ships.
Does next/image already optimize your images?
Partly, and it is the useful part. next/image handles the mechanics: it generates responsive srcset widths, negotiates AVIF or WebP by request, defers offscreen images, and holds layout with width and height. Those are execution details, and it executes them well (Next.js docs, 2026).
The mechanics are not the same as the decision. Format and size answer "how do I deliver this asset," not "how much of this asset's data actually matters." The component gives you a quality prop defaulting to 75 and no way to reason about whether 75 is right for a given photograph versus a flat diagram. That is the gap, and it lives above the component, not inside it. The wider category view sits in our CMS image optimization hub.
What should you get right first?
The next/image fundamentals, because they are cheap and they work. In our experience auditing Next.js sites, most failing LCP scores trace back to two or three missing basics, not an exotic technique.
Set priority on the LCP image so it is not lazy-loaded, which is the single most common own-goal we see. Use sizes accurately so a phone requests a phone-sized source, not the desktop hero. Keep AVIF enabled in next.config for photographic content, since it routinely lands 30 to 50% smaller than equal-quality JPEG with broad support today (caniuse AVIF, 2026). Serve from the edge and cache aggressively.
None of this is exotic and all of it helps. But finishing the checklist just returns you to the same open question. More on the vitals link in Core Web Vitals and image weight.
Why is one quality prop the real ceiling?
Because a single number cannot fit a diverse library. Set quality={75} globally and you have made one assumption about thousands of assets that have nothing in common. A hero photograph, a UI screenshot, a logo, and a flat gradient do not carry the same perceptual information, yet they all get the same treatment.
The failure is symmetric, which is why it hides. Push the number down and you strip detail from the images whose detail was the entire reason they exist. Push it up and you ship bytes you never needed on the flat assets, inflating the very LCP you were trying to protect. Both directions report as success because the only thing most pipelines measure is file size, and file size is the wrong metric: why file size is the wrong metric.
One global setting is exactly the blanket-compression trap dressed in a nicer API, a pattern we break down in why blanket compression hurts your CMS.
Build-time or publish-time: where should this live?
Publish-time, for anything that touches a CMS. The classic Next.js instinct is to solve images at build: an import plugin, a script over the public folder, a preprocessing step in CI. That works right up until a non-engineer needs to publish a new hero and there is no rebuild in their workflow.
Build-time optimization couples every image decision to a deploy. Publish-time optimization decouples them, so a content editor uploading through your CMS gets the same per-asset treatment an engineer would, with no pipeline knowledge required. The asset is evaluated, routed, verified, and delivered on the way through. That is the same model we describe end to end in the media pipeline from upload to delivery.
How does per-asset optimization plug into a Next.js app?
The principle stays constant: evaluate each asset individually, choose its optimization path on its own merits, and verify the result before it ships. next/image still does what it is good at, delivery mechanics, while the quality decision moves up a layer and stops being a single hardcoded prop.
For a Next.js project specifically, the integration sits at the source: assets are optimized as they enter the media pipeline or CMS your app reads from, so the URLs next/image receives already point at per-asset-optimized sources. Your components do not change. The quality prop stops being the thing that matters.
Under the hood, our Neural Media Orchestrator evaluates each asset and selects the optimal path from 352 possibilities, delivering up to 95% neural compression savings on photographic sources while holding structural similarity at or above 0.975 against the original. It is Pareto-safe by routing, so it never delivers a result larger than the strongest adaptive baseline. The tradeoff space is in neural versus adaptive compression compared.
How do you know it will not degrade the hero?
Because every optimized asset is verified against a perceptual quality floor before delivery, and anything that cannot clear the floor falls back instead of shipping degraded. That is the whole difference between automatic optimization and automatic damage.
If a designer-grade hero can hit its byte target inside the structural similarity floor, it ships small. If it cannot, the system delivers a safer result rather than quietly degrading the image and calling it a saving. We publish how that floor is measured in our benchmark methodology, and the codec results in our H.266 benchmark.
How do you fix the images already in production?
With a one-time library scan, not a manual audit. The per-asset model handles every new upload going forward, but a live Next.js site usually sits on months or years of assets that shipped under a single quality prop, and those are the ones inflating your current Largest Contentful Paint.
A library scan evaluates the existing set, projects the savings per asset, and processes them in priority order, so the heaviest offenders on your most-trafficked routes get fixed first. Each result is verified against the same structural similarity floor, and anything it cannot clear falls back rather than shipping degraded. The approach scales to very large libraries, which we cover in optimizing a million images without breaking your site. Nothing about your next/image usage changes; the sources it points at simply get lighter.
Frequently Asked Questions
Does next/image optimize image quality automatically?
next/image handles responsive sizing, AVIF and WebP negotiation, and lazy-loading, but quality comes from a single quality prop that defaults to 75. It applies that one value to every asset, so per-asset quality is a decision you still own.
Should I optimize Next.js images at build time or publish time?
Publish-time for anything a CMS feeds. Build-time optimization couples every image to a deploy, which breaks when a non-engineer publishes a new asset. Publish-time optimization treats each asset as it enters the pipeline, with no rebuild.
Will per-asset optimization hurt my LCP?
It should improve it. LCP suffers when heavy hero images ship more bytes than they need. Per-asset optimization right-sizes each asset to its actual perceptual requirement, and a verified floor prevents over-compression from replacing weight with visible damage.
What image format is best in Next.js?
AVIF for photographic content, typically 30 to 50% smaller than equal-quality JPEG, with WebP as the fallback. next/image negotiates this for you. Format is table stakes, though; the harder question is how much quality each asset needs.
Do I still need next/image if I optimize per asset?
Yes. next/image handles delivery mechanics: srcset, format negotiation, lazy-loading, and layout stability. Per-asset optimization handles the quality decision above it. They solve different problems and work best together.
The point
Next.js gave you an excellent image component and got out of the way, which is exactly what you wanted from it. The quality prop is not a bug; it is an honest admission that the component cannot know how much quality your hero needs.
That decision belongs one layer up, in the publishing flow, made per asset and verified against a perceptual floor before anything ships. Get the next/image basics right, then stop treating one number as if it fits a thousand different images. Content teams on Drupal hit the same wall from a different angle in Drupal image optimization, as do designers in Webflow image optimization. The category view is in the CMS optimization hub.