-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use pngquant to optimize PNG images #583
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there's a compelling reason to use a lossy compressor like pngquant, can we use one of the several lossless ones instead?
zopflipng, optipng, advpng, and pngcrush are all lossless options that have npm wrappers.
This script is overkill for electron/website
but does show invocation recipes for trying to maximize lossless compression from these four tools
The compelling reason is the significant reduction in size for imperceptible visual change. I briefly tied a lossless optimizer on one of the larger files as a test and it was something like a 15% reduction, compared to 75% with pngquant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea. LGTM once @BlackHole1's comment is addressed. :)
8abb0a0
to
93ec2e1
Compare
Had an offline discussion with @ckerr regarding his comment, and moving ahead with taking the easy win here and we can follow up with other improvements in the future, such as committing losslessly optimized versions of the files to begin with. 👍 |
Uses
imagemin-pngquant
to optimize PNG images at build time.Significantly reduces the size of images used on the home page, shrinking transferred size from 4.4 MB to 1.2 MB.
It's technically lossy optimization, but I don't think anyone can tell the difference between this and this unless you've got Superman eyes.
Before:

After:
