Design - Photoshop

Improving Website Performance with Image Optimization

In the Internet’s early days it could take 24 hours, or more, to download a picture. Image compression technologies were developed to help speed up the process. Although the web is far faster than it was in the old days, optimizing images is still as important as ever.

Many parts of the world still access the Internet via dial up modem, or mobile devices. Reducing image size speeds up download times and reduces the amount of data transferred to mobiles. By taking the extra steps to ensure your images are the smallest possible file size, you’re doing your audience a huge favour.

The three most common image formats used on the web are GIF, JPG and PNG. The GIF format uses lossless compression: pixels are compressed in order to shrink file size, and then decompressed when the image is unpacked. The JPG format uses lossy compression. Pixels are destroyed during compression. Both GIF and JPG are proprietary file formats, so royalties need to be paid for their use in software.

The PNG format, besides using lossless compression, is open source. Its use requires no licensing fees. Until recently, PNG hasn’t been fully supported by all web browsers, limiting its use for websites. Now it’s at least partially supported by all major browsers, making it a viable image format.

Each file format has its strengths. JPG and PNG-24 are best suited for continuous tone images such as photos that contain thousands or millions of colours. Also, PNG-24 supports full alpha transparency, making it ideal for complex logos and layered backgrounds.

GIF and PNG-8 are indexed colour formats that can have between 2–256 colours, and transparency. They’re ideal for images with large areas of flat colour, such as illustrations and line drawings, or logos. Their 8-bit transparency is simple: the pixel is either on or off, which can leave a jaggy halo around image elements. JPG doesn’t support transparency.

We’ll demonstrate image optimization using a photograph.


Feel free to download a copy of the image we’re using in this tutorial. Simply right (or control-click) on the above image and select Save Image as …. Open it in your image editor and you’e good to go.

I’ll show you how to optimize a JPG in this article and will cover PNG and GIF optimization in the next one.

Optimizing Photos

The image we’re using has already been processed. It’s important to work on a copy of the original because editing JPG files is destructive, meaning that pixels are permanently changed each time it’s saved. I’m using Photoshop CC, but the process is similar in other image editors.

  1. Open an image in your editor.
  2. Go to File > Save for Web … (Or Export for Web …).
  3. Select the 4-up tab (if you’re using Photoshop).
  4. In the right panel, set the long side of the image to 600 pixels. Resizing the image in this dialogue doesn’t alter the original image’s pixels and allows you to explore different file size and image dimension combinations before committing any.
  5. The first preview pane holds the original image.
  6. Activate the second preview pane by single clicking it. Set the quality to 60%.
  7. Activate the third preview pane by single clicking it. Set the quality to 40%.
  8. Activate the fourth preview pane by single clicking it. Set the quality to 20%.
  9. Zoom in on the previews (in Photoshop, click the plus (+) button in the lower left corner of the dialog). Analyzing the previews at 200% will reveal any compression artifacts – blurry squares or smeery bits.
  10. Experiment with different image dimensions and JPEG quality. When you find a combination of size and quality that works for you, click save.
  11. Navigate to your web images folder and click okay.

Screenshot of Photoshop's Save for Web … dialog.

Screenshot of Photoshop’s Save for Web … dialog.

Although the technical steps for image optimization are the same, I haven’t written an action or batch command to handle image optimization because images vary in detail and quality. Automating the process produces uneven results.


The hard part of image optimization is finding the right balance between image quality and file size. The pay offs for taking these extra steps are images that download quickly, using less storage on the server and less data on mobile devices. In short, your site downloads faster, saving your audience time and, with respect to the cost of their data plans, money. It might not close the deal all by itself, but it’s a foot in the door.

In this tutorial you learned how to optimize JPG images for the web and why image optimization should become an integral part of preparing your images for web use. In the next article, I’ll show you how to optimize images in GIF, PNG-8 and PNG-24 formats, and how to decide which format is better for a given image.

The start image is 825Kb in size. The final image is a miserly 58Kb.

The start image is 825Kb in size. The final image is a miserly 58Kb.

About the author

Gord taught the graphic design program at a private college for six years. He also wrote nineteen of the program's courses. After six years leading classes, he felt it was time to learn how to be a graphic designer again. In addition to graphic design, Gord's an accomplished writer. Digital painting and photography are two of his hobbies.

Share this post

Comments are closed.

Subscribe To Our Newsletter