Dev.to WebDev 🛠 Dev 👁 0 📖 7 min read

I Audited My Own Site's Images. The srcset Reflex Was Wrong for Half of Them.

Every responsive-image guide ends the same way: add srcset and sizes, you are serving desktop images to phones. I ran that advice against our own production site this morning, and it broke on our own numbers. Not because

I Audited My Own Site's Images. The srcset Reflex Was Wrong for Half of Them.

Every responsive-image guide ends the same way: add srcset and sizes, you are serving desktop images to phones. I ran that advice against our own production site this morning, and it broke on our own numbers. Not because the advice is wrong, but because it skips the step that decides whether it applies.

Here is what I measured, how I measured it, and the order I now check things in.

Conceptual AI illustration in Design Den Solutions' orange, black and white 3D editorial style: an oversized image tile with a mountain-and-sun pictogram is squeezed down onto a small smartphone while a measuring caliper spans its width, and beside the phone the same tile appears as a descending staircase of three correctly sized versions. A black panel on the left carries the official Design Den Solutions logo unchanged above the headline "ONE IMAGE / EVERY SCREEN / MEASURE THE BOX" and the caption "Same pixels, two codecs: 1,944 KB PNG vs 156 KB JPEG". A white footer bar shows the phone number +91 98721 90965 and the website www.designdensolutions.com.

The audit

21 URLs from the live sitemap.xml, fetched with a plain Node script (no browser, no build step, nothing installed). For every <img> tag I recorded srcset, sizes, width, height, loading, and then fetched each unique image to read its intrinsic dimensions straight out of the file signature (PNG IHDR, JPEG SOFn) and its delivered byte length.

The site-wide result:

Measured Value
Pages 21
<img> elements 187
Elements with srcset 0
Elements with sizes 0
<picture> / <source> elements 0
Unique images 69 (47 PNG, 15 JPEG, 7 unreadable)
Images served as WebP or AVIF 0
Images with a Cache-Control header 0

So yes: zero responsive markup, site-wide. That part of the standard advice applies to us completely.

But then I looked at where the bytes actually were.

The first surprise: the homepage was not the problem

The homepage has 61 image elements totalling 830 KB — and 59 of them carry loading="lazy". Only the 5 KB logo loads eagerly. First paint on the homepage is not paying for those images at all.

The page that is actually heavy is a service page:

Page HTML CSS JS Images Total Image share
digital-marketing.html 26.7 KB 77 KB 603.6 KB 4,737 KB 5,445 KB 87 %
graphic-design.html 27.5 KB 77 KB 603.5 KB 2,820 KB 3,528 KB 80 %
/ (homepage) 102.3 KB 0.7 KB 604.4 KB 830 KB 1,537 KB 54 %

digital-marketing.html has one lazy-loaded image. The five-card gallery that makes up most of its weight loads all six of its PNGs eagerly, on every visit, before anything scrolls.

If I had stopped at "homepage has lots of images", I would have fixed the wrong page. Measure eager bytes, not total bytes. loading="lazy" changes the answer completely, and it is invisible in a byte count that does not separate them.

The second surprise: on a phone, we are not over-serving

This is the step the standard advice skips, and it is arithmetic rather than opinion.

The gallery cards sit in .work-showcase, which is repeat(3, 1fr) above 1024 px, two columns at 641–1024 px, and one column at or below 640 px. The container is min(100% - clamp(28px, 6vw, 48px), 1280px), tightening to -32px under 1024 px and -24px under 480 px. Each card is aspect-ratio: 4/3 with the image at width: 100%; height: 100%; object-fit: cover.

So the CSS box — the thing a srcset is supposed to match — is:

Viewport Columns CSS box × DPR 2 × DPR 3
1440 3 413 × 309 826 1,239
1024 2 486 × 364 972 1,458
390 1 366 × 274 732 1,098

The source images are 1024 × 1536.

On a 390 px phone at DPR 3 — a modern iPhone or Pixel — the card needs 1,098 device pixels wide. Our source is 1,024. The phone is not receiving an oversized image; it is receiving a slightly undersized one.

On a 1440 px desktop at DPR 1, the card needs 413 and gets 1024. That is 2.5× the width, 6.1× the pixels, and it is real waste.

Same file, same site, opposite conclusions. srcset is a fix for the desktop case here and does nothing for the phone case. Which is the opposite of how the advice is usually written.

So the honest rule is:

Compute CSS box width × devicePixelRatio for each breakpoint you actually support. Only if the delivered width exceeds it meaningfully is srcset the right tool.

The third surprise: the codec was the whole story

Since dimensions were not the phone problem, I looked for what was. I re-encoded the six gallery PNGs with the same pixels and only changed the container, using System.Drawing at quality 80:

File As PNG As JPEG q80, identical 1024×1536 Ratio
dm-growth-01.png 1,944 KB 155.6 KB 12.5×
dm-strategy-01.png 635.5 KB 159 KB 4.0×
dm-ads-01.png 542.6 KB 152.1 KB 3.6×
dm-email-01.png 434.5 KB 169.5 KB 2.6×
dm-campaign-01.png 522.6 KB 215.3 KB 2.4×
dm-seo-01.png 499.1 KB 236.8 KB 2.1×

No pixels removed. No resolution changed. Just a container that suits photographic content instead of one that suits flat graphics.

Rolling the five visible gallery cards up: 4,080 KB as delivered, 592 KB as JPEG q80 at 2× the desktop CSS box — 85.5 % off. At the 390 px box, 493 KB — 87.9 % off.

That single number is bigger than every responsive-markup fix on this page combined.

The fourth surprise: resizing PNG made it worse

This one is the reason I am writing this up instead of just filing a ticket.

I generated a 972 px-wide PNG for the 1024 breakpoint, expecting a smaller file. dm-growth-01 went from 1,944 KB to 2,487 KB. It got 28 % bigger after losing 5 % of its pixels. The same thing happened at every other width: the 826 px PNG was 1,843 KB, and the 732 px PNG was 1,462 KB — all still above, or barely below, the original.

Lossless PNG pays for the resampling filter's new edge and gradient data. A photographic 3D render has no flat colour runs to exploit, so shrinking it can raise its entropy faster than it lowers its pixel count.

If you add srcset with PNG variants of a photographic image, you can make the page heavier while making the markup more correct. I would have shipped that if I had trusted the reflex instead of measuring.

The order I check in now

  1. Separate eager from total. loading="lazy" moves the answer. Count bytes that load before the first scroll.
  2. Compute the box, then multiply by DPR. Read the grid and aspect-ratio rules, don't eyeball a screenshot. If delivered width ≈ box × DPR, srcset buys you nothing.
  3. Change the codec before you change the markup. Same pixels, container swap. On our gallery this was 2.1×–12.5×.
  4. Then add srcset for the breakpoints where step 2 showed a real gap — for us, the desktop columns.
  5. Check Cache-Control last, but don't skip it. All 69 images on our site ship without it, so browsers fall back to heuristic freshness from Last-Modified. Nothing is cached deterministically.

The markup, for the case where it does apply

Once you know the box, srcset is short. The w descriptor plus sizes is the form I use, because it lets the browser do the DPR maths against a length it can measure:

<img
  src="[email protected]"
  srcset="[email protected] 413w,
          [email protected] 732w,
          [email protected] 826w,
          [email protected] 1024w"
  sizes="(max-width: 640px) calc(100vw - 24px),
         (max-width: 1024px) calc((min(100vw - 32px, 1280px) - 20px) / 2),
         calc((min(100vw - 48px, 1280px) - 40px) / 3)"
  width="1024" height="1536"
  loading="lazy" decoding="async"
  alt="Growth marketing campaign visual">

sizes has to describe the layout, not the file. If your card is a 1fr column inside a min()-sized container with a gap, that is what goes in sizes. A wrong sizes is worse than no srcset, because the browser trusts it.

Two things that are easy to get wrong in this specific pattern:

  • object-fit: cover crops, so the visible pixels are not the whole file. Our source is 2:3 portrait into a 4:3 landscape box. Width governs the cover scale, so matching srcset to the box width is right — but if you instead sized by the area of the box you would under-serve badly.
  • Keep width and height as intrinsic pixel values even when you serve a smaller file. They are the aspect-ratio hint that prevents layout shift. Ours are correct today, which is the one thing this gallery already got right.

For genuine art direction — a different crop per breakpoint, not just a different size — that is <picture> with <source media>, and it is a different decision. We have zero <picture> elements and, on the evidence above, do not need them yet.

What I am not claiming

  • No field data. Chrome UX Report has said "not enough usage data" for this domain for months. Every figure here is a lab measurement on one machine, from one observation point, with no throttling and no synthetic monitoring.
  • Quality was not assessed. I measured bytes at q80. I did not run a visual A/B, so "q80 is acceptable for these images" is not a finding, it is an assumption to check before shipping.
  • WebP and AVIF were not measured. My toolchain had no encoder for them. They would very likely beat the JPEG numbers again, so treat 592 KB as a conservative floor, not the target.
  • The PNG inflation is one encoder's resize filter. HighQualityBicubic specifically. The general point — verify that a downscaled lossless variant is actually smaller — holds regardless.
  • 7 unreadable in the format tally means my header parser did not recognise them, not that they are broken.

We have a live site, and I found the wrong thing to fix by trusting a rule of thumb. Check the box before you check the markup.

Prepared with AI assistance and reviewed for accuracy by Design Den Solutions. The measurements come from scripts run against our own production site on 17 November 2026; the audit and re-encode scripts and their JSON output are described in this article rather than attached.

We build and maintain responsive websites, and image weight is something we now measure before we recommend a fix. If your site's first load is heavier than you expected, that is work we take on: web development services — +91 98721 90965.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.