People who do not use or cannot use Adobe Photoshop ,whatever the reason maybe, processing large number of images could be a pain for them. And for those who use Photoshop, it could be a slow process. Using ImageMagick to resize images from Command Line is faster. It may not be as easy as click-click but yes, its free and available on all Operating Systems.
ImageMagick has a command other than convert (most commonly used) called mogrify. Mogrify lets you resize, blur, crop, flip-flop images using the batch process. You can simply specify the folder which contains the images and mogrify can batch process the images inside that folder. You can also change the format of the images; like, if you want to convert JPG pictures into PNG. Now let’s see how you can achieve this –
Before you proceed, please note when using following commands it will override the original images until you specify a different format of the resulting images. However, there is a way around, which I will be sharing in the next post.
Command to convert all JPG images to a fixes size of 1280*768
mogrify -resize 1280*768 *.JPG
Note, if you need the exact size which you specified in the command and disregard the aspect ratio which mogrify takes care by default; you can use the following command.
#Notice the '!' sign after the size. #It forces the size given and ignores the Aspect Ratio. mogrify -resize 1280*768! *.JPG
If you are not too sure about the size and you just want to reduce the size of an image, you can also specify the size in percentage, as follows –
mogrify -resize 50% *.JPG
If you want to convert all JPG files into PNG, then use the following command.
mogrify -format PNG *.JPG
The above command will convert all JPG images into PNG within the current folder. This will create a new copy of the images and the previous JPG files will remain as it is.