Bypass Sharp for animated GIFs in DocImage and ImageGallery#417
Merged
Conversation
The default Sharp pipeline re-encodes GIFs to WebP, which drops every frame after the first (losing animation) and also blows past Sharp's default pixel limit on large multi-frame GIFs — e.g. shared-subscription-demo.gif (1846x1004, 317 frames) fails the build with "Input image exceeds pixel limit". GIFs now skip raster processing and are served as-is, the same way SVGs already are.
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.
Summary
pnpm buildfails withInput image exceeds pixel limitonsrc/assets/images/docs/mqtt-broker/user-guide/shared-subscription-demo.gif(1846×1004 × 317 frames ≈ 588M px). Astro's Sharp service reads GIFs withpages: -1(all frames) and Sharp's defaultlimitInputPixelsis ~268M, so the metadata read throws before any transform runs.DocImageandImageGallerynow skipgetImagefor.gif, the same way they already do for.svg, and serve the original Vite asset. Astro was already passing animated GIFs through unchanged on the happy path (verified indist/— file is byte-identical to source with all frames preserved), so no visual or animation regression for the other 8 GIFs in the repo — only the build failure is removed.