Dev.to WebDev πŸ›  Dev πŸ‘ 2 πŸ“– 4 min read

Our own gallery images total 4.8 MB of PNG. The same five as WebP: 445 KB

Our own gallery images total 4.8 MB of PNG. The same five as WebP: 445 KB "Your images are optimised" is a claim, not a state. We say it to clients, so this week we pointed the same audit at our own site β€” and the wors

Our own gallery images total 4.8 MB of PNG. The same five as WebP: 445 KB

Our own gallery images total 4.8 MB of PNG. The same five as WebP: 445 KB

"Your images are optimised" is a claim, not a state. We say it to clients, so this week we pointed the same audit at our own site β€” and the worst single file on it is 1,990,679 bytes of PNG for an image that renders about 390 CSS pixels wide on a phone.

Here is the whole method, the numbers, and the fix, because none of it is special to our site.

Editorial cover on off-white paper: a giant glossy photo print sags over a small digital scale whose display glows orange, beside a stack of prints. Huge orange type reads 1.99 MB above black type reading For One Image. Design Den Solutions logo top centre; +91 98721 90965 and www.designdensolutions.com along the bottom.

Method

  1. Fetched all 21 URLs in our sitemap with a desktop browser user-agent.
  2. Parsed every <img> tag: src, alt, width, height, loading, srcset, sizes, fetchpriority.
  3. Re-fetched every unique image URL and recorded Content-Length, the real intrinsic dimensions (PNG IHDR / JPEG SOF), Content-Type, Cache-Control and ETag.
  4. Converted the five heaviest gallery files in headless Chrome β€” canvas.drawImage + toBlob('image/webp', 0.8) β€” at full size, at 700 px wide and at 390 px wide.

No CDN is in front of the images. What the server sends is what the visitor downloads.

What the site actually ships

Measure Result
Unique images across 21 pages 69
PNG 46 files, 11,612,054 bytes
JPEG 15 files, 1,179,246 bytes
WebP 7 files, 1,645,942 bytes (all web-portfolio screenshots)
<img> tags with srcset 0
Images missing alt 0
Images missing width/height 0
Cache-Control / ETag on image responses absent (Apache, Last-Modified only)

The boring accessibility work was already done β€” every image has alt text and intrinsic dimensions. The expensive mistakes are in the bytes:

Page Unique images Image bytes
digital-marketing.html 8 4,339,945
insights.html 8 3,025,575
graphic-design.html 8 2,888,152
social-media.html 7 2,383,666
web-development.html 7 1,344,405

On digital-marketing.html, the HTML is 27,398 bytes and our own CSS + JS is 154,572 bytes. The images are 4.34 MB β€” 96% of the page's own weight β€” and they all sit in one .work-showcase grid that renders two columns on desktop (~630 px per card) and one column on mobile (~390 px). Every card downloads the same 1024Γ—1536 file.

The worst offender, dm-growth-01.png, is 1,990,679 bytes. That is 1,266 bytes per 1,000 pxΒ². Our JPEGs on the same site measure 98–177.

The conversion experiment

Same pixels, different encoders, quality 0.8:

File PNG WebP full WebP 700 px WebP 390 px
dm-growth-01.png 1,990,679 100,192 56,228 23,542
brochure-02.png 736,856 111,936 56,362 20,600
sm-creative-02.png 718,264 112,592 58,730 23,038
packaging-01.png 714,656 43,340 17,828 5,986
poster-01.png 651,020 76,564 40,510 16,674
Total 4,811,475 444,624 229,658 89,840

Full-size WebP: 90.8% smaller. At the size the browser actually paints it: 95.2% smaller. At mobile card width: 98.1% smaller. Plain JPEG at q=0.8 would already have saved 84.0%, so this is not a WebP-specific trick β€” it is PNG being used to store photographic gradients, which is the one job PNG is worst at.

Note what did not move: dimensions, alt text, layout stability. The images were already properly sized in markup; only the encoding and the single fixed width were wrong.

The fix, in order of leverage

1. Change the format, keep a fallback. One <picture> per card:

<picture>
  <source
    type="image/avif"
    srcset="assets/work/dm-growth-01-640.avif 640w,
            assets/work/dm-growth-01-1024.avif 1024w"
    sizes="(max-width: 720px) 92vw, 630px">
  <source
    type="image/webp"
    srcset="assets/work/dm-growth-01-640.webp 640w,
            assets/work/dm-growth-01-1024.webp 1024w"
    sizes="(max-width: 720px) 92vw, 630px">
  <img src="assets/work/dm-growth-01-1024.jpg"
       alt="Growth campaign visual"
       width="1024" height="1536" loading="lazy" decoding="async">
</picture>

The width/height pair stays so the grid keeps its aspect ratio before the bytes arrive. sizes must match the real CSS grid, or the browser picks the wrong candidate and you save nothing.

2. Lazy-load everything below the fold. Our homepage already does (59 of 61 tags). The service-page galleries do not β€” each page has exactly one lazy image (the header logo) and seven to nine eager gallery images. loading="lazy" is a one-attribute change, but never put it on the hero/LCP image.

3. Set cache headers. Right now every image response is Last-Modified only, so browsers fall back to heuristic freshness and revalidate far more often than needed. For versioned asset paths:

Cache-Control: public, max-age=31536000, immutable

4. Only then chase fractions. AVIF over WebP, per-image quality tuning, hero preload β€” these matter, but they are rounding errors next to a 1.99 MB PNG.

Caveats, honestly

  • These are byte measurements at q=0.8, not a visual QA pass. Glassy renders with fine gradients need a per-image look; two of the five may want q=0.85 and still beat PNG by 10Γ—.
  • "95% smaller" is a statement about transferred bytes, not a promise about LCP. We did not run Lighthouse in this pass and will not quote a score we did not measure.
  • Heuristic caching without Cache-Control still works β€” the header gap costs revalidation round-trips, not necessarily a full re-download.

What we are changing

This week: re-encode the 17 gallery PNGs over 100 KB (10.75 MB between them) to 640/1024 WebP with JPEG fallback, add srcset/sizes, move the galleries to loading="lazy", and add immutable caching to /assets/. The markup and alt text stay as they are β€” they were already right.

If you want the same pass run on your own site β€” measurement first, then the fix list β€” that is part of the web development work we do from Mohali: Design Den Solutions web development.

Article and cover image prepared with AI assistance and reviewed for accuracy by Design Den Solutions. The cover is a conceptual illustration with the official company logo composited unchanged, not a screenshot of a real page. All figures above were measured on our own live site on 3 December 2026 (IST); the raw audit is reproducible with the method in the first section.

πŸ“° 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.