Journal
Aug 22, 2026·2 min read· Web

Light previews for heavy screenshots

The covers for my projects are full-page screenshots, some of them thousands of pixels tall. On a case study page that is the point: you scroll the whole site inside a browser frame. On a card, or seven of them on a phone, it is a disaster.

Decoded size is what counts

A 500 KB JPEG is not 500 KB in memory. Decoded, an image costs width × height × 4 bytes. A 1440 × 9000 screenshot is about 52 MB. Seven of those is how a phone tab dies without an error message.

A preview next to every image

When an image is uploaded, the server also writes a small copy:

  • 720 px wide, enough for a card at two pixels per point,
  • only the top 2160 px, because the top of a page is what a card shows,
  • WebP at moderate quality.

The preview's storage key is derived from the original's, so there is no new database column: given an image you can always compute where its preview lives.

Use the right one in the right place

Cards, lists and anything on a phone load the preview. The case study page loads the original. If a preview is missing, an onError handler falls back to the original, so nothing breaks for older uploads while they are backfilled.

Load only what is near

In a swipeable deck of projects, only the current card and its neighbours get an image. The rest show the project's colour until they are next.

Result

Previews are tens of kilobytes instead of megabytes, and the phone crash that started all this has not come back.