Skip to content

Instantly share code, notes, and snippets.

@vivekvasani
Forked from MikeNGarrett/bulk-resize-script
Last active August 29, 2015 00:33
Show Gist options
  • Save vivekvasani/48f476236d051dc1f7bb to your computer and use it in GitHub Desktop.
Save vivekvasani/48f476236d051dc1f7bb to your computer and use it in GitHub Desktop.
Imagemagick recursively reduce files to < 800x600 and 72ppi
# This is a bash script meant to be run on the command line. Requires imagemagick (apt-get install imagemagick)
## THIS WILL OVERWRITE YOUR FILES, uses sudo and may not require it.
for file in /path/to/files/*/*.jpg; do sudo convert $file -resize '800x600>' -density 72 $file; done
### another method using resolution (800*600)
for file in /path/to/files/*/*.jpg; do sudo convert $file -resize '480000@>' -density 72 $file; done
### example of *not* overwriting files
for file in /path/to/files/*/*.jpg; do sudo convert $file -resize '800x600>' -density 72 converted-$file; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment