-
Notifications
You must be signed in to change notification settings - Fork 131
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: lossless png compression #585
base: main
Are you sure you want to change the base?
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.
We don't want the changes to images under docs/
as they'll be overwritten by the next docs update.
It would be nice if we had a way to verify the changes were actually lossless (not just for this PR, but any future ones), so we don't risk committing lossy changes that then get further lossy changes on top of them in the future. This comment suggests that If we can verify that the output is lossless, we could rig that script up as a GitHub Actions workflow to run after every push to |
Interesting! I believe these compressors are lossless but I haven't done anything to confirm it. It's possible that I'm holding one of them wrong. I'll do a little digging to see if there's a good way to check and will mark this PR as a draft in the interim. Agree on |
I still have some work to do on this, but just to check in: I've found two reasons that a lossless compression could still fail checksum tests:
The closest thing I could find to a clean off-the-shelf test for equality was using ImageMagick's |
I used this script to run lossless compression utils [zopflipng, optipng, advpng, pngcrush] dialed to maximum (e.g.
advpng --shrink-insane
) on all the png files in the repo.The ugly: this is very slow, which is why I'm PR'ing the changed files instead of adding the process to a workflow.
The good: this PR reduces the total size of png files in the repo from 14,328,881 bytes to 6,536,247 bytes, a lossless savings of about 55%.
See also #583 (comment). CC @dsanders11, @BlackHole1, @erickzhao who were all active in that PR.