-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Add oxipng to pre-commit #29925
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
base: main
Are you sure you want to change the base?
Add oxipng to pre-commit #29925
Conversation
And it seems |
The compressed images cause a single failure due to a warning:
|
Thanks for giving it a try and sorry for the unexpected hassle. I use it in a GitLab project and since the pre-commit CI doesn't support that, I have to run it on the diff from the latest main (set in the script), so not sure if it runs on all files, but it is a reasonable guess I would assume. A small caveat that is worthwhile to consider is that if the compression improves, it will fail the tests. I wanted to have some sort of threshold, but the developers didn't see a need to support that (but suggested that one scripts it). (Edit: one may not want to commit a new image, just because the new compression removed 4 bytes...) But, good thing, size decreases. Just a bit boring if one will need to re-commit lots of compressed images... |
PR summary
@oscargus suggested oxipng in #29816.
I went with the hook suggestion of
-o 4
compression (though their normal default is 2), though maybe we want to up it to the max, since it shouldn't happen very often. I did not enable metadata stripping (as suggested) since knowing what version of Matplotlib was used for the plot might be useful. I also didn't add alpha channel optmization, as they say it is technically lossy.PR checklist