Created
February 6, 2021 18:50
-
-
Save koveseb/0acef315aa34631f53ab183521206e88 to your computer and use it in GitHub Desktop.
Resizes batches of images
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 | |
# Purpose: batch image resizer | |
# Source: https://guides.wp-bullet.com | |
# Author: Mike | |
# absolute path to image folder | |
FOLDER="images" | |
# max height | |
HEIGHT=800 | |
# max width | |
WIDTH=800 | |
#resize png or jpg to either height or width, keeps proportions using imagemagick | |
#find ${FOLDER} -iname '*.jpg' -o -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \; | |
#resize png to either height or width, keeps proportions using imagemagick | |
#find ${FOLDER} -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \; | |
#resize jpg only to either height or width, keeps proportions using imagemagick | |
find ${FOLDER} -iname '*.jpg' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \; | |
# alternative | |
#mogrify -path ${FOLDER} -resize ${WIDTH}x${HEIGHT}% *.png -verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment