Repository navigation
build: Optimize retaken screenshots and add an image optimization hook - #21124
Draft
sentry-junior[bot] wants to merge 6 commits into
Draft
sentry-junior[bot] wants to merge 6 commits into
sentry-junior[bot] wants to merge 6 commits into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.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.optimize-imagespre-commit hook that runs the script on staged PNG and JPEG files, the same way thetrailing-slasheshook fixes links.AGENTS.mdthat 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.gifis 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
prekis 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?
PRE-MERGE CHECKLIST
via shannon.anahata.
--
View Session [Sentry]