Create fixed size thumbnails with ImageMagick

Posted: Thu, Mar 10 03:41 AM (PST)

First get Image Magic and install it. You'll find the binary release for any platform accompanied with installation instructions on the Image Magic website.

The Image Magic tool we use is convert. It lets us apply various filters and operations to the images in just one step. Open terminal and go to the directory where you placed the images. What we are going to do is to resize all pictures to 100×100 pixels keeping proportions (no stretch or squash) and then extend the canvas size to exactly 100×100 pixels so that all thumbnails have the same size.

convert -resize 100x100 -gravity center -extent 100x100 -background white big_cover.jpg small_cover.jpg

-resize 100x100 it's self explanatory. Note that the image is not stretched to fit the given dimensions.

-gravity center centers the thumbnail in the canvas.

-extent 100x100 extends the proportionally resized image to fit exactly 100×100 pixels.

-background white create a white canvas to the thumbnail. If the image does not fit completely the 100×100 space, convert will fill the empty space with the specified color.

PS: For better quality, we recommended use PNG format

Tags: