September 19, 2018

Saving Images for the Web: Part 2

For Photographers

If you haven’t read my previous post about saving images for the web, click here.

What You Will Need:

  • A basic understanding of using CLI (Command Line Interface)
  • An install of ImageMagick on your machine
  • A full size JPEG file in a folder on your desktop

What is ImageMagick?

ImageMagick is a CLI program that can manipulate over 200+ graphic file types. It is a powerful tool and will allow you to create file for the web at the smallest size while preserving the quality.

1. Prepare a Folder with Full Resolution Images

To do this, simply select the images you’d like to upload and then export them to a folder on your desktop. Here, I am using a folder called “gallery” and with three images. See below.

2. Open CLI at the path of the folder

To do this on Mac, right click the folder>Services>New Terminal at Folder

3. Write Your Modify Code

This code will take the images in the folder and resize them, strip metadata, resample, and prepare for the web in all in one go.

Here I am using a code I have developed. Below is the code I am using, you’re more than welcome to use it, just be sure to modify geometry to your specifications.

The “-geometry” command specifies the widthxheight of your desired image. As you can see in the above example, I have this set to a height of 600 in the above example, but if I wanted to do 600 pixels wide and an auto height that preserves the aspect ratio of the image, I’d just type “-geometry 600x” instead.

4. Preview your Files

At the beginning, we started with a 20mb file, after resizing, the image became 21kb… That’s over a 10000% reduction in size. Fair warning, you may want to avoid using 70 as your quality, 80 is good for most people.

That’s it! Now we can proceed to upload these files to our WordPress system and use them for the appropriate places. Please let me know if you have any questions in the comments.