You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running PNGs through zopflipng makes them smaller, with no drawbacks. This patch was done with zopflipng version 1.0.1 with the -m option, and decreases the in-tree total size size of all *.png by almost 100KiB.
$ find -name "*.png"| xargs du -bc | tail -n 1 # before
291101 total
$ find -name "*.png"| xargs du -bc | tail -n 1 # after
194639 total
Hi, The idea is interesting, but IMO it would be more efficient to contribute to Sphinx, so all documentations will benefit of smallest pictures. There is a similar tool for JPEG. Victor
scop commented on Jul 7, 2016
scopmannequin
MannequinAuthor
More actions
Sure, I plan to suggest this to sphinx as well.
One corresponding tool for JPEGs is jpegoptim and its --strip-all option, but there is only ./Mac/BuildScript/resources/background.jpg in the cpython source tree (which despite of the .jpg extension appears to be a PNG file so I don't want to touch that stuff), plus ./Lib/test/imghdrdata/python.jpg which isn't worth a patch alone :)
there is only ./Mac/BuildScript/resources/background.jpg in the cpython source tree (which despite of the .jpg extension appears to be a PNG file so I don't want to touch that stuff)
Activity
scop commentedon Jul 7, 2016
Running PNGs through zopflipng makes them smaller, with no drawbacks. This patch was done with zopflipng version 1.0.1 with the -m option, and decreases the in-tree total size size of all *.png by almost 100KiB.
vstinner commentedon Jul 7, 2016
Hi, The idea is interesting, but IMO it would be more efficient to contribute to Sphinx, so all documentations will benefit of smallest pictures. There is a similar tool for JPEG. Victor
scop commentedon Jul 7, 2016
Sure, I plan to suggest this to sphinx as well.
One corresponding tool for JPEGs is jpegoptim and its --strip-all option, but there is only ./Mac/BuildScript/resources/background.jpg in the cpython source tree (which despite of the .jpg extension appears to be a PNG file so I don't want to touch that stuff), plus ./Lib/test/imghdrdata/python.jpg which isn't worth a patch alone :)
vstinner commentedon Jul 7, 2016
Oh funny, you're right: it's a PNG file :-)
scop commentedon Jul 26, 2016
Updated patch against tip.
Before: 289426 total
After: 194638 total
StanFromIreland commentedon Sep 12, 2025
This was already done in #74845
I will check if doing it again has any benefit
gh-71648: Remove unused image `Doc/faq/python-video-icon.png` (GH-138841
gh-71648: Optimize PNG files (GH-138842)
[3.14] pythongh-71648: Optimize PNG files (pythonGH-138842)
[3.13] pythongh-71648: Optimize PNG files (pythonGH-138842)
StanFromIreland commentedon Sep 12, 2025
For reference, adding a
pre-commithook to automatically optimize is tracked in #138848[3.13] gh-71648: Optimize PNG files (GH-138842) (#138852)
[3.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851)
kerajbereta-code commentedon Sep 16, 2026