Last active
January 14, 2022 19:57
-
-
Save long-blade/2f6bd88f59e4fb972fb889216f74654d to your computer and use it in GitHub Desktop.
[Image resizer] Resize images for a directory of image files. #bash, #bashscripting
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/bash | |
## execute: bash resize.sh /path/to/files | |
for f in "$1"/*.{jpg,png}; do | |
[ -f "$f" ] || continue #skip in case f is not a regular file. | |
base=$(basename "$f") | |
echo "Converting $1/${base%.*}.${base##*.}" | |
convert "$f" -resize 1920x1322 -gravity center -background white -extent 1600x1102 "$1/${base%.*}.${base##*.}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment