Last active
August 23, 2024 12:47
-
-
Save dmandrade/0b6067cdc75345a9b3c095285e931825 to your computer and use it in GitHub Desktop.
Resize or rename all images in a folder
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
# Resize images in folder | |
$ npm install sharp-cli | |
$ find . -name '*.jpg' | gawk -F'.jpg' '{ printf "sharp -i \"%s\" -o ./%s-thumb.jpg resize 321 485\n", $0, $1 }' | bash | |
# Rename folder image in sequential order | |
$ find . -name '*.jpg' | gawk 'BEGIN{ a=1 }{ printf "mv \"%s\" %d.jpg\n", $0, a++ }' | bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment