Last active
June 4, 2024 09:41
-
-
Save agarzon/a56563e6f7ed6fb7b3ff to your computer and use it in GitHub Desktop.
JPG recursive resize and compress (Linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#find . -type f -name '*.png' -exec optipng -o5 -quiet -preserve {} \; | |
#find . -type f -name '*.jp*' -exec mogrify -compress jpeg -quality 70 {} \; | |
find . -type f -iname "*.jp*g" | xargs mogrify -resize '1280x1280>' | |
find . -type f -iname "*.jp*g" | xargs jpegoptim --strip-all --max=90 | |
# With parallel | |
find . -type f -iname "*.jp*g" -print0 | parallel --progress -0 -j +0 "mogrify -resize 1280x1280\> {}" | |
find . -type f -iname "*.jp*g" | parallel --progress "jpegoptim --strip-all --max=65 {}" | |
find . -type f -iname "*.jp*g" -print0 | xargs -0 -n1 -P4 jpegoptim --strip-all --force --quiet --max=85 {} | |
find . -type f -iname "*.png" -print0 | xargs -0 -n1 -P4 optipng -o5 -quiet -preserve {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment