Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salvatorecapolupo/d207d362986527791c927bf1cb63dec2 to your computer and use it in GitHub Desktop.
Save salvatorecapolupo/d207d362986527791c927bf1cb63dec2 to your computer and use it in GitHub Desktop.
# funziona in modo ricorsivo per tutti i file nella directory corrente
# va bene per le immagini di un sito per risparmiare banda e spazio
#prima passata: ricampiona a 960px massimo di altezza, formatta a compressione 80
find . -type f -name '*.jpg' -exec sips -s formatOptions 80 --resampleHeight 960 {} \;
#seconda passata: solo per i file grossi
find . -type f -size +1M -name '*.jpg' -exec sips -s formatOptions 35 --resampleHeight 960 {} \;
#terza ed ultima passata: togliere di mezzo gli EXIF
find . -type f -name '*.jpg' -exec sips sips --deleteColorManagementProperties {} \;
#riferimento
https://trovalost.it/comprimere-tutte-le-immagini-di-wordpress-risparmiare-banda/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment