The other day I was applying for a job through their website, where I had to provide my photo in a predefined resolution. Indeed they wanted my photo to be in 600×600 pixels. I had to resize my photo before uploading it to that site. I used ImageMagick, a great image suite.
I installed ImageMagick in Debian using:
apt-get install imagemagick
Resizing images using ImageMagick is easy and self-explanatory. I used the following format:
convert image.jpg -resize 600x600 resized_image.jpg
This way, image file named image.jpg was resized to resized_image.jpg in 600×600 pixels.
But this process has a problem. The aforementioned command format preserves the aspect ration of the image. To fully resize any image in a specific ratio, the following command is used instead:
convert image.jpg -resize 600x600\! resized_image.jpg
This command format forces the image to resize in the intended ration ignoring any aspect ration.
Images can also be resized to scale in any particular amount specified. To put it simply, images can be resized in their percentage scale. The command format is:
convert image.jpg -resize 50% resized_image.jpg
Here, any percentage ratio of the image can be used instead of 50%.
Images can also be resized in their pixel area count. For example, 600×600 sized image has a pixel area count of 360000. This is useful to make a collection of images almost same size. The command format is:
convert image.jpg -resize 360000@ resized_image.jpg
Of course, 360000 can be replaced with any other pixel area count. Just make sure @ is there after the pixel area count for this command. That’s all.