Recompresser des images JPEG / PNG sans perte de qualité

  • JPG monotask : find . -name \*.jpeg -exec jpegoptim -pt
  • JPE?G multitask : find . -regextype posix-extended -iregex '.*(jpeg|jpg)' -print0 | xargs -0 -P $((`nproc` / 2)) jpegoptim -pt [1]
  • PNG multitask : find . -name \*.png -print0 | xargs -0 -P $((`nproc` / 2)) -I {} zopflipng -m --lossy_8bit --lossy_transparent -y {} {} [2]

Notes

[1] find can accept regex ; See Rip music CD to MP3 or FLAC for -print0 / -0

[2] -I {} permit to choose a replacement token for file names ; here we explicitely set zopflipng calls to overwrite files