← All tools

Tool · Tampermonkey userscript

Image Size Highlighter

Outlines every image on a page by whether its file is the right size for how it's displayed.

Version
1.6.1
Licence
MIT
Runs on
Any site
Shortcut
Alt+Shift+Y

Needs the free Tampermonkey extension for Chrome, Firefox, Edge or Safari. Install it first, then the script.

01 / The check

Making sure image sizes are optimal

An oversized image wastes bandwidth and an undersized one looks blurry, and neither is obvious by eye. After years of fixing print-sized uploads, I wanted the problem visible the moment a page loads.

02 / Features

What it does

  • Colour-coded outlines

    Orange or red if too big, yellow if blurry, green if right.

  • Size badges

    Actual, displayed and needed size, and how far off it is.

  • High-DPI aware

    Accounts for retina screens and browser zoom.

  • Filename labels

    Shows which file the browser actually chose from srcset or picture.

  • Summary panel

    Counts of oversized, blurry and well-sized images.

  • Copes with real sites

    Ignores lazy-load placeholders and rechecks as content changes.

03 / How to use it

4 steps

  1. Step 1: Install Tampermonkey, then the script.

  2. Step 2: Load any page: images are outlined straight away.

  3. Step 3: Click a badge to log full details, including download size, to the console.

  4. Step 4: Ctrl/Cmd+click a filename to open the image. Alt+Shift+Y turns the script on or off.

04 / Under the hood

How it's built

Compares each image's natural pixels with its displayed size multiplied by the device pixel ratio. A MutationObserver and a light rescan catch lazy-loaded and swapped images, and every label sits in Shadow DOM so it can't affect the page.

  • Web performance
  • Images
  • Debugging
  • JavaScript
Next tool Webpage Guidelines

All my userscripts, free and open source

Browse on GitHub