HOWTO batch resize pictures

Resize and apply prefix:

$ for file in *.jpg; do convert $file -resize 25% re_$file; done

Add suffix _re, place the files in parent folder

$ convert *.jpg -resize 80% -set filename:f '%t' ../'%[filename:f]_re.jpg'

Will place converted files in the folder above.

The option -set filename:f ‘%t’ sets the property filename:f to the current filename without the extension. Properties beginning with filename: are a special case that can be referenced in the output filename. Here we set it to ../’%[filename:f].jpg, which ends up being the image filename with the extension replaced with _re.jpg in the parent directory.

Advertisements

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

%d bloggers like this: