requiem31
requiem31

Reputation: 177

change images size of all images - linux terminal

Say I wanted to change the size of a picture and keep the name the same, in terminal I would type: convert picture1.jpg -resize 1280x720! picture1.jpg Now what if I had a folder with hundred of these pictures and I wanted to change them all to 1280x720 and keep the same name. Is there any easier way then typing out that line for each picture?

Upvotes: 0

Views: 316

Answers (3)

Mark Setchell
Mark Setchell

Reputation: 207425

That's exactly what mogrify is for:

mogrify -resize 1280x720! *.jpg

Upvotes: 0

mikyra
mikyra

Reputation: 10367

In case there is tons of images you might run into trouble using an for f in *.jpg approach. In this case you might want to do something like:

find myfolder -maxdepth 1 -name *.jpg -exec convert \{\} -resize 1280x720! \{\} \;

Upvotes: 0

Ewan Mellor
Ewan Mellor

Reputation: 6847

cd myfolder
for file in *.jpg
do
    convert "$file" -resize 1280x720! "$file"
done

Upvotes: 2

Related Questions