GIF output palette size doubles (from 8 to 16)
See original GitHub issuePossible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
- Running
npm install sharp
completes without error. - Running
node -e "require('sharp')"
completes without error.
If you cannot confirm both of these, please open an installation issue instead.
Are you using the latest version of sharp?
- I am using the latest version of
sharp
as reported bynpm view sharp dist-tags.latest
.
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of sharp
that is not the latest, please open an issue against that package instead.
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?
System: OS: macOS 12.6 CPU: (8) x64 Apple M1 Pro Memory: 28.89 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.17.2 - ~/.nvm/versions/node/v14.17.2/bin/node npm: 6.14.13 - ~/.nvm/versions/node/v14.17.2/bin/npm npmPackages: sharp: ^0.31.1 => 0.31.1
What are the steps to reproduce?
- Take any input animated gif
- Call
await sharp('input_filename.gif', { animated: true }).toFile('output_filename.gif');
- File size is more than double the original.
What is the expected behaviour?
Output file size should be the same or nearly the same as the input file size.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
await sharp('input_filename.gif', { animated: true }).toFile('output_filename.gif');
Please provide sample image(s) that help explain this problem
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Animated GIF Best Practices - Create & Optimize GIFs Like Pros
Learn how to improve GIF quality and the tricks to getting the best GIF size. Use this guide to create animated GIFs that...
Read more >Size of GIF way too high? - ffmpeg - Super User
Because of how GIFs work, the more complicated the palette, the resulting gif becomes larger pretty quickly.
Read more >How to reduce GIF filesize without losing quality - YouTube
This is how I export small but high quality animated GIFs for my animation portfolio website, or for websites like Tumblr with filesize ......
Read more >AspJpeg.com - User Manual Chapter 9: GIF Output
GIF format requires that a palette contain 2, 4, 8, 16, 32, 64, 128, or 256 colors. Each color entry in a palette...
Read more >How to Reduce GIF File Size for Better Website Performance
Reduce the number of colors in the image. GIFs only display 256 colors, but if your image only has a few, then reduce...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The new
interFrameMaxError
andinterPaletteMaxError
GIF options are exposed in commit https://github.com/lovell/sharp/commit/5740f4545efd2c4fd0d98a2b6104f8e0da111e66 and will be part of v0.31.3.Example usage:
v0.31.3 now available with support for
interFrameMaxError
andinterPaletteMaxError
.