Resize multiple images of different sizes to same size

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
lsilver
Posts: 1
Joined: 2014-06-01T20:44:05-07:00
Authentication code: 6789

Resize multiple images of different sizes to same size

Post by lsilver »

I have several hundred photos of different dimensions. I need to create a thumbnail of these images at 100x100.

I don't want to distort the photos so I'll need to add some kind of white space and horizontally/vertically center the image so that any white space would create a uniformed size border in white.

Examples:

Photo 200 x 200 = resized to 100 x 100 with no white space
Photo 300 x 200 = resized to 100 x 100 but proportional would be to 100 x 66.67 so there would need to be 33.33 px of white space added to the height
Photo 200 x 300 = resized to 100 x 100 but proportional would be to 66.67 x 100 so there would need to be 33.33 px of white space added to the width

Is this possible and if so, how?

Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resize multiple images of different sizes to same size

Post by fmw42 »

see
http://www.imagemagick.org/Usage/thumbnails/#pad

this uses -thumbnail 100x100 and -gravity center -extent to pad it out

leave off the -define if you do not have jpeg images.

In the future, please always identify your version of IM and platform, since syntax and commands may differ.
Post Reply