Created
August 5, 2019 03:48
-
-
Save nanmu42/10f87271a0b057ff62879d68de5a2ea2 to your computer and use it in GitHub Desktop.
Opitimize JPEG and PNG to a both smaller file size and resolution
This file contains hidden or 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
#!/usr/bin/env bash | |
FOLDER=$1 | |
MAX_WIDTH=1400 | |
MAX_HEIGHT=1000 | |
# resize, strip metadata and save in a lower quality | |
# aspect ratio will be kept. | |
find ${FOLDER} \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec convert \{} -verbose -strip -quality 75 -resize "${MAX_WIDTH}x${MAX_HEIGHT}>" \{} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment