resize images in a single line

you got a bunch of photos you wanna resize in width and height … lets say 800px will be enough. Fire up a shell, cd in the directory where your photos stored.

for i in $(ls -1 *.jpg | sed 's/ /;/g'); do
   convert -resize 800x800 "$(echo $i | sed 's/;/ /g')" "/path/to/destiantion/$(echo $i | sed 's/;/ /g')"
done

The “sed ‘s/ /;/g’” is to handle filenames with a blank.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>