openoffice icon indicating copy to clipboard operation
openoffice copied to clipboard

Add pre-commit hook oxipng for lossless compression of PNGs

Open jbampton opened this issue 5 months ago • 2 comments

This hook is very CPU intensive so we don't want to add it to the CI.

So I set the hook stage to manual and you can do a full repository clean up locally from the repo root by running:

pre-commit run --all-files --hook-stage manual

So I ran the oxipng clean up and we now have less data, smaller file sizes for the same quality

https://github.com/oxipng/oxipng

https://github.com/oxipng/oxipng?tab=readme-ov-file#git-integration-via-pre-commit

https://en.wikipedia.org/wiki/Lossless_compression

jbampton avatar Aug 04 '25 19:08 jbampton

Reducing the size of AOO is always a good idea! Can you estimate how much smaller it would get?

Pilot-Pirx avatar Aug 16 '25 13:08 Pilot-Pirx

I used the following commands from "Google" and if correct it makes it about 2 megabytes smaller

openoffice$ git branch
  add-basic-editorconfig
  add-license-hook-yaml
  add-script-for-ignored-words
  chmod+x-shell-scripts
  pre-commit-add-oxipng
* trunk
  whitespace-cleanup-cfg
  whitespace-fixups-2
  whitespace-fixups-pmk
openoffice$ find . -type f -iname "*.png" -print0 | du -ch --files0-from=- | tail -n 1
54M     total
openoffice$ git checkout pre-commit-add-oxipng 
Switched to branch 'pre-commit-add-oxipng'
Your branch is up to date with 'origin/pre-commit-add-oxipng'.
openoffice$ find . -type f -iname "*.png" -print0 | du -ch --files0-from=- | tail -n 1
52M     total
openoffice$ 

jbampton avatar Aug 16 '25 14:08 jbampton