Created
December 2, 2019 03:12
-
-
Save junjizhi/76db0628f159a8ece0109452b581b833 to your computer and use it in GitHub Desktop.
Resize all image files to half of the sizes
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
#!/usr/bin/env bash | |
set -euxo pipefail | |
# Usage: | |
# cd /path/to/images/directory | |
# bash resize.bash | |
shopt -s extglob | |
for filename in [^resize]*.?(jpg|jpeg|png); do | |
newFile="resized-$filename" | |
if [ ! -f "$newFile" ]; then | |
convert $filename -resize 50% $newFile | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment