Re-compress a folder of PNG files in parallel, using all your cores
You can do this, to process a folder full of PNG files, four at once:
find . -iname "*png" -print0 | xargs -0 --max-procs=4 -n 1 advpng -z -4 -q
This just runs each file through advpng
to maximally compress the existing image data, losslessly, without changing the colour depth or quality at all.
You can adjust the --max-procs=4
bit to match the number of cores you have - or maybe one less, if you want to process a lot of images and do other things in the meantime.
There are alternatives to advpng
- if you prefer pngout
or pngcrush
, just replace the advpng -z -4 -q
with your preferred compression tool.
Written by Duncan Lock
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#