Last active
January 14, 2022 19:57
[Image resizer] Resize images for a directory of image files. #bash, #bashscripting
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/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