linux

linux: resizing image files in batch mode

I did the following using Fedora 25:

1 – Install ImageMagick


sudo dnf install -y ImageMagick.x86_64

2 – I needed to replace all the spaces located in the files names:


find ./ -depth -name '*.jpg' -execdir bash -c 'mv "$1" "${1// /_}"' _ {} \;

3 – Then I finally resized all the files to 45% of the original size, adding a the resized prefix in each one:


for i in $( ls *.jpg); do convert -resize 45% $i rezised_$i; done

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s