data science

Resizing Images – Shell Script

I go this from an awesome post by user80168.

Is uses the convert to resize all the files that end in ‘.jpg’. It will create a directory called ‘resized’ and then it will reduce the size of each image to 50% of it’s original size.

# create a directory where the resized images will go
mkdir resized

# now go through each jpg file
for a in *.jpg; do 
    # convert each jpg file to 50% of original, and place in resize folder
    convert "$a" -resize 50% resized/"$a"; 

There. It is sooooo easy.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s