Skip to content

Instantly share code, notes, and snippets.

@dmandrade
Last active September 26, 2019 23:11
Show Gist options
  • Save dmandrade/0b6067cdc75345a9b3c095285e931825 to your computer and use it in GitHub Desktop.
Save dmandrade/0b6067cdc75345a9b3c095285e931825 to your computer and use it in GitHub Desktop.
CLI util commands
# 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