If you have limited depth of directories and not too many files, then lazy solution:
pngquant *.png */*.png */*/*.png
A standard solution:
find . -name '*.png' -exec pngquant --ext .png --force 256 {} ;
and multi-core version:
find . -name '*.png' -print0 | xargs -0 -P8 -L1 pngquant --ext .png --force 256
where -P8
defines number of CPUs, and -L1
defines a number of images to process in one pngquant call (I use -L4
for folders with a lot of small images to save on process start).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…