When building a website you want to keep your image sizes down. One way to do that is to make sure they are sized correctly. While resizing images is not a hard job to do, it can be very time consuming especially if you need to resize a lot of images.
Batch resizing your images is the solution here. You may have thought that you needed photoshop or some other image processing software in order to do this. Fear not I have a free and easy solution. This one is for the Linux and Mac users out there.

  1. Fire up your terminal application (If you are unfamiliar with terminal stay tuned as we will have a series of useful tutorials for you on this topic in the future.)
  2. Next, we need to install ImageMagick. The quickest way to do this is using homebrew.

You will need to type the following command.
brew install ImageMagick
3. Now we have ImageMagick installed we need to create a folder for our images we want to batch resize. While you can create this wherever you want, we are going to keep this easy by installing it in the home directory using the following command:
mkdir ~/batch_image_resize
4. We now need to move into the folder we just created:
cd ~/batch_image_resize
5. Put the image you want to resize into the folder we created in step 3. It pays to make a backup copy of these images at the original size as you won’t be able to reverse/undo the resize once it happens.
6. Here is where the magic happens. We are going to resize these images to 400px wide. Replace 400 with whatever size you need. The beauty of this method is that the height will resize automatically so that the scale of the image is perfect
mogrify -geometry 400x *.jpg
mogrify -geometry 400x *.png
If you have any other image files with different extensions (gif, pdf etc) just replace the extensions at the end of the commands above.
Now all images are perfectly resized and have a much smaller file size.