Created
March 26, 2014 00:57
-
-
Save MikeNGarrett/9774888 to your computer and use it in GitHub Desktop.
Imagemagick recursively reduce files to < 800x600 and 72ppi
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
# 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
@Fayozjon you would use the image geometry properties to specify the width only.
convert $file -resize '1000'
I don't think you can specify the
>
to resize only images larger than the specified dimensions, so be careful with this.Ready more about Image Geometry.