Resize your images for a fixed canvas, fast and free

Everyone who creates content has faced this issue once in a while if not every time they get down to writing/creating. People who are trying to insert galleries on their website face it issue as well.

Every piece of content asks for an image if not a number of them. And more often than not you have images on hand that have different orientations and dimensions:-

  • Portrait of dimensions such as 100 x 275
  • Landscape of dimension such as 600 x 100

On top of that, the dimensions vary widely. So in a typical situation, you would need to display two such images on a canvas of say 150 x 150 pixels. Lots of solutions that are (easily) available help you to

  • Resize — to 150 x 150 dimensions in which case because the aspect ratio is different, the image would be stretched; or
  • Crop — something similar to above, just that in this case instead of stretching, the image would be clipped. IrfanView (I am sure other tools would have similar features, I just tend to prefer IrfanView for its simplicity) has a nice capability where you could simply auto-crop an image on that dimension while pivoting on any of the 9 different positions (such as Center, Middle Top) on the image.

The above two work, to an extent, when used together.

What I would really want is that a tool

  1. Create a canvas of 150 x 150.
  2. Align the center of the image with that of the canvas.
  3. Resize the image while keeping its original aspect ratio intact and making sure its longest dimension is below 150.
  4. And most importantly, run the above steps for a batch.

ImageMagick does this and does with lesser effort compared to even the biggest commercial behemoth out there. And it is “free”.

Just make sure you have it in the Path variable while installing.

Go to directory where your images are stored and run the following command on your command line (let me know in the comments if you are not really comfortable with the command line).

The best part is that the conversion is really fast.

Learner, Innovator, I respect creativity and good design. Working for Thames Technologies (