Image Optimization Techniques That Move the Needle
Practical image optimization techniques for real web performance gains: modern formats like WebP, responsive sizing, lazy loading, and zero layout shift.

Images are usually the heaviest thing on a web page. On a typical marketing site or online store, they account for more downloaded bytes than your HTML, CSS, and JavaScript combined. So when a homepage feels sluggish on a mid-range Android phone over a patchy mobile connection in Riyadh or Cairo, the culprit is rarely your code. It's a 2.4 MB hero photo exported straight from a designer's machine and dropped into the page at full resolution.
Image optimization is the highest-leverage web performance work most teams never get around to. It doesn't require rewriting your stack or hiring a new team. Done well, it shrinks page weight dramatically, improves Core Web Vitals, and lifts the metrics you actually care about: bounce rate, conversions, and search rankings. Here are the techniques that genuinely move the needle, in roughly the order of impact.
Serve modern formats: WebP and AVIF
The single biggest win for most sites is changing the file format. The web ran on JPEG and PNG for two decades, and both are now outclassed.
- WebP typically produces files 25-35% smaller than a JPEG at equivalent visual quality, and it supports transparency (so it can replace PNG too). It's supported by every browser you need to care about today.
- AVIF goes further, often 50% smaller than JPEG, with better handling of gradients and fine detail. Browser support is strong on modern devices, with a slightly older long tail.
You don't have to choose. The <picture> element lets the browser pick the best format it supports and fall back gracefully:
<picture>
<source srcset="hero.avif" type="image/avif">
<source srcset="hero.webp" type="image/webp">
<img src="hero.jpg" alt="Team reviewing a project dashboard" width="1200" height="675">
</picture>
The browser tries AVIF first, then WebP, then the JPEG as a universal fallback. Older clients still get a working image; everyone else gets a much lighter one.
Don't forget the quality slider
Format alone isn't the whole story. Most images are exported at quality settings far higher than the eye can detect. For photographic content, a WebP or AVIF at quality 70-80 is usually indistinguishable from the original at a fraction of the size. Test on real images and trust your eyes, not the default export preset.
Size images for how they're actually displayed
A staggering amount of wasted bandwidth comes from serving a 4000px-wide image into a slot that renders at 600px. The browser downloads every pixel, then throws most of them away.
Two tools solve this:
srcsetandsizeslet you provide several resolutions and tell the browser how wide the image will display, so it downloads the right one for the device and viewport.- Responsive breakpoints mean a phone never downloads a desktop-sized file.
<img
src="product-800.webp"
srcset="product-400.webp 400w, product-800.webp 800w, product-1600.webp 1600w"
sizes="(max-width: 600px) 100vw, 50vw"
alt="Wireless headphones in matte black"
width="800" height="800">
A phone on a slow connection pulls the 400px version; a desktop on a retina display gets the crisp 1600px one. Nobody overpays.
Lazy loading: only fetch what people see
Most visitors never scroll to the bottom of a page, yet the traditional browser behaviour is to download every image up front. Lazy loading defers off-screen images until the user is about to reach them, which speeds up the initial render and saves data for people who bounce early.
The good news is that native lazy loading is now a one-line attribute:
<img src="gallery-3.webp" alt="Project gallery" loading="lazy" width="600" height="400">
Two rules of thumb:
- Lazy-load below-the-fold images — galleries, footers, long article bodies, product grids further down the page.
- Never lazy-load your hero or LCP image. The largest element visible on first paint should load as early as possible. Lazy-loading it actively hurts your Largest Contentful Paint score. For that one critical image, consider
fetchpriority="high"instead.
Reserve space and prevent layout shift
Fast loading is only half the experience. If images pop in and shove the text around as the page loads, it feels broken even when it's quick. That jolt is measured as Cumulative Layout Shift (CLS), one of Google's Core Web Vitals.
The fix is simple and often skipped: always set explicit width and height attributes (or a CSS aspect-ratio) on every image. This lets the browser reserve the correct space before the file arrives, so nothing jumps. You'll notice we've included width and height in every example above. That's deliberate.
Build it into the pipeline, not the to-do list
Manual optimization works once and then rots. The next time a marketer uploads a banner through the CMS, you're back to a 3 MB PNG. Optimization has to be automatic.
- Use a framework that handles it. Next.js ships an Image component that generates responsive sizes, modern formats, and lazy loading automatically. Most modern frameworks have an equivalent.
- Put a CDN or image service in front. Tools that transform images on the fly let you request the format, size, and quality you need from a single source file, with global caching close to your users in the GCC and beyond.
- Compress at the source. Run uploads through automated compression (build-step tooling or a CMS plugin) so unoptimized files never reach production.
- Set a page-weight budget and watch it in your performance monitoring. A regression check that fails the build when images balloon is worth more than any one-off cleanup.
For teams serving customers across Saudi Arabia, the UAE, and Egypt — where a meaningful share of traffic is on mobile data — this discipline is not a nice-to-have. It's the difference between a site that loads before attention drifts and one that doesn't.
Key takeaways
- Switch formats first. Serving WebP and AVIF with a JPEG fallback via
<picture>is the fastest, highest-impact change you can make. - Right-size every image with
srcsetandsizesso devices never download more pixels than they render. - Lazy-load below the fold, but never your hero or LCP image — and use
fetchpriorityto load the critical one first. - Always set width and height to eliminate layout shift and protect your Core Web Vitals.
- Automate the whole thing with a framework Image component, a CDN, and a page-weight budget, so optimization survives the next upload.
Image optimization is one of those rare improvements where the engineering effort is modest and the payoff — faster pages, better SEO, happier visitors — is immediate and measurable. If your site feels heavy and you're not sure where to start, we can help. Take a look at our services and our work, or get in touch and we'll audit your page weight and put a proper optimization pipeline in place.
About the author
Mazen Salah
Founder & Lead Engineer
Mazen Salah founded SummationWorks in 2019 to help startups and growing businesses ship real software. He leads engineering across the company's web, mobile, and AI work, building products with Next.js, Flutter, Laravel, and Node.
More about usRelated Articles
engineeringBuilding Fast Web Apps in 2026
How we ship production-grade web apps that load instantly and scale — the stack, the trade-offs, and the habits behind it.
engineeringAPI Rate Limiting and Abuse Protection: A Practical Guide
How API rate limiting and abuse protection keep your backend stable: throttling strategies, layered defenses, and limits that don't punish real users.
engineeringApp Store and Play Store Submission: How to Avoid Rejections
Most app rejections are preventable. A practical guide to clearing App Store and Play Store review on the first try, from privacy to payments.