Skip to content

build: Optimize retaken screenshots and add an image optimization hook - #21124

Draft
sentry-junior[bot] wants to merge 6 commits into
masterfrom
jr/optimize-retaken-screenshots
Draft

sentry-junior[bot] wants to merge 6 commits into
masterfrom
jr/optimize-retaken-screenshots

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

DESCRIBE YOUR PR

#21086, #21089, and #21103 committed browser screenshots as full-color 24-bit PNGs, mostly 250–300KB each, with one at 991KB. Those images are part of what pushed the platform-content function over Vercel's 250MB limit (fixed separately in #21121).

This PR:

  • Optimizes the 110 PNGs from those PRs, taking them from 22.6MB to 6.7MB. They become 256-color palette PNGs (libimagequant at quality 90, through sharp, which the repo already depends on). Paths and dimensions stay the same. UI screenshots have few colors, so text and edges stay sharp. The lowest PSNR across the set is 40.8 dB, on the illustrated 2FA invite page, and side-by-side checks look the same.
  • Adds scripts/optimize-images.mjs (pnpm optimize-images <file>...). It shrinks PNG and JPEG files in place. It skips PNGs that already use a palette, and it only rewrites a file when the result is at least 10% smaller, so a second run changes nothing.
  • Adds an optimize-images pre-commit hook that runs the script on staged PNG and JPEG files, the same way the trailing-slashes hook fixes links.
  • Adds an Images section to AGENTS.md that tells agents to run the script on images they add or change, since agent sandboxes often don't have the hooks installed.

docs/api/guides/img/create-internal-integration.gif is left as is. Lossy GIF re-encoding produced visible streaks, so the script doesn't handle GIFs.

The commits are split into batches because one push with every image was too large.

Open question: the hook only runs where prek is installed. A CI check that fails on unoptimized images would enforce this for every contributor, but it would block people who add screenshots without the hook, so that's left as a docs team decision.

IS YOUR CHANGE URGENT?

  • Urgent deadline (GA date, etc.): YYYY-MM-DD
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

PRE-MERGE CHECKLIST

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

via shannon.anahata.

--

View Session [Sentry]

sentry-junior Bot and others added 5 commits December 4, 2026 20:18
Browser screenshots are full-color PNGs, about 3x larger than needed.
The script turns them into palette PNGs, and the hook runs it on staged
PNG and JPEG files.

Co-Authored-By: Shannon Anahata <shannon.anahata@sentry.io>
Convert full-color PNGs from #21086, #21089, and

Co-Authored-By: Shannon Anahata <shannon.anahata@sentry.io>
#21103 to palette PNGs with scripts/optimize-images.mjs.
Convert full-color PNGs from #21086, #21089, and

Co-Authored-By: Shannon Anahata <shannon.anahata@sentry.io>
#21103 to palette PNGs with scripts/optimize-images.mjs.
Convert full-color PNGs from #21086, #21089, and

Co-Authored-By: Shannon Anahata <shannon.anahata@sentry.io>
#21103 to palette PNGs with scripts/optimize-images.mjs.
Convert full-color PNGs from #21086, #21089, and

Co-Authored-By: Shannon Anahata <shannon.anahata@sentry.io>
#21103 to palette PNGs with scripts/optimize-images.mjs.
@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
develop-docs Ready Ready Preview Dec 4, 2026 8:32pm UTC
sentry-docs Ready Ready Preview Dec 4, 2026 8:32pm UTC

Request Review

@github-actions github-actions Bot added the Priority: Normal Docs review has no urgent deadline label Dec 4, 2026
@codeowner-assignment
codeowner-assignment Bot requested a review from a team December 4, 2026 20:22

This branch was successfully deployed

2 active deployments
Preview – sentry-docs — d0e65045 Deployed Dec 4, 2026 by vercel[bot]
Preview – develop-docs — d0e65045 Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants