How To Batch Image Resize?
If you want to resize your photos to put them on your blog or website. As you know, you can’t upload your photos on a webpage with the highest resolution because a web gallery became inaccessible and too slow to load. Then maybe you have a folder containing every photo of your holidays and you want to resize it at 768 of width maintaining the original aspect ratio. To make a resize there are many tools but here I suggest a command-line tool called “mogrify”. This tool will be installed with ImageMagick Libraries, so all you have to do is installing ImageMagick.
Here I am assuming that your operating system is Ubuntu Hardy:
1 | sudo apt-get install imagemagick |
After ImageMagick installed, you can use mogrify.
For example, you have a folder called “travels” located in “/home/yourname/Pictures/“. Go to that directory, make a thumbs folder and copy original images into “thumbs”. After that you can start the image resizing process:
1 2 3 4 | cd /home/yourname/Pictures/travels mkdir thumbs cp /home/user/yourname/Pictures/travels/* /home/yourname/Pictures/travels/thumbs/ cd thumbs |
1 | mogrify -resize 640 *.jpg |
Now you will see in “/home/yourname/Pictures/travels/thumbs/” every your image file resized to 768 of width. If you want to force resizing to a particular size without maintaining the original aspect ratio you could change mogrify options:
1 | mogrify -resize 768×576! *.jpg |