Menu

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

DEV Community: htmlΒ·Design Den SolutionsΒ·3 days ago
#qWcmAwXy
#devto2#devto#dev#bytes#webp
Long article (981 words) β€” no AI summary yet.
Reading 0:00
15s threshold

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.

Method

Fetched all 21 URLs in our sitemap with a desktop browser user-agent.

Parsed every <img> tag: src , alt , width , height , loading , srcset , sizes , fetchpriority .

Re-fetched every unique image URL and recorded Content-Length , the real intrinsic dimensions (PNG IHDR / JPEG SOF), Content-Type , Cache-Control and ETag .

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.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.