Skip to content

feat: downscale images that are much larger than displayed - #1379

Merged
AlexAndBear merged 1 commit into
mainfrom
feat/resize-oversized-images
Nov 16, 2026
Merged

AlexAndBear merged 1 commit into
mainfrom
feat/resize-oversized-images

Conversation

@AlexAndBear

Copy link
Copy Markdown
Member

Many screenshots are stored much larger than they are ever displayed. For example, the Android screenshots are 1344×2992 px but shown at 180×400 px. Readers download the full file anyway. This PR downscales those images to twice their display size, which is still sharp on high-DPI (Retina) screens.

Download size for readers

Image bytes of all images on a page, summed over every page of the built site: 445 MB → 265 MB (-40%). No page got bigger.

Per page, measured in Chromium after scrolling through the whole page:

Page Before After
user/ios-app/files-and-folders/create-rename-move 7.38 MB 1.47 MB
user/android-app/files-and-folders/create-rename-move 1.25 MB 0.42 MB
user/ios-app/shortcuts (de) 0.68 MB 0.22 MB
user/ios-app/general/set-up 0.58 MB 0.16 MB
user/general/settings 2.67 MB 1.80 MB

All images the site serves: 103 MB → 72 MB.

How

  • For every PNG, the largest display width on any page that uses it is taken from its width attribute (or a style width), capped at 1300 px. 1300 px is the widest the content column gets: 958 px with a table of contents, 1288 px without one.
  • Images more than 15% wider than 2× that width are resized to exactly 2× with ImageMagick (-filter Lanczos) and recompressed with oxipng -o 2 --strip safe. Images are never upscaled and stay PNG.
  • That applied to 1784 images. For 498 of them, mostly flat UI screenshots with few colors, the downscaled file wasn't smaller, because resampling adds in-between colors that compress worse. Those are left unchanged, so 1286 files change.
  • The width/height attributes in the docs stay the same, so the layout doesn't change.
  • The README's screenshot guidelines now say to save images at most twice their display size.

Checked in Playwright

  • Same layout: on 14 pages at 1280×800 and 390×844, every image renders at the same size as before (max. 0.24 px difference from aspect ratio rounding), no image is distorted, and all images load.
  • Image quality: I took element screenshots of 11 images at device pixel ratio 2 and 3 and compared them with main, including phone screenshots, a photo and full-width screenshots with small text. At DPR 2 they look the same. At DPR 3 (many phones), the 2× images are scaled up 1.5×, so text looks very slightly softer in a direct side-by-side comparison, but it's fully legible.
  • pnpm build, pnpm lint:md and pnpm format:check pass. The broken-anchor warnings are the same 50 as on main.

1784 PNGs were more than 2.3x wider than their largest display width on
any page, e.g. 1344x2992 phone screenshots shown at 180x400. Downscale
them to twice their display width (capped at the 1300px content column)
with ImageMagick (Lanczos) and recompress with oxipng. Files where the
result wasn't smaller are left unchanged, so 1286 images change.

Also add a note on the maximum image resolution to the README.
Copilot AI balanced review requested due to automatic review settings November 16, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Only the README diff is available, so the 1,286 resized images cannot be checked for retained content, aspect ratios, or visual quality.

No open issues 🎉

What changed in this PR

This PR aims to reduce screenshot download sizes while preserving display layout and high-DPI clarity. The reviewed README change documents sizing guidance to support that goal.

Changes:

  • Clarifies that screenshot width guidelines refer to display sizes.
  • Recommends saving images at no more than twice their displayed dimensions, with examples for pop-ups and phone screenshots.
  • Sets a 2600px maximum width for full-screen screenshots based on the 1300px content-column limit.
File Description
README.md Adds screenshot sizing guidance to reduce image downloads while retaining clarity.

Review effort: Balanced

@Svanvith Svanvith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@AlexAndBear
AlexAndBear merged commit 13ee709 into main Nov 16, 2026
7 checks passed
@AlexAndBear
AlexAndBear deleted the feat/resize-oversized-images branch November 16, 2026 12:46
@openclouders openclouders mentioned this pull request Nov 16, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ Proxy