GTmetrix Performance Blog

News, updates and guides on GTmetrix and general web performance

What Does Image Optimization Mean?

One of the easiest ways to speed up your site and improve your GTmetrix Grade/Performance/Structure Scores is image optimization.

Uncompressed and improperly sized images carry a lot of extra weight and force your users to download unnecessary data. Optimizing your images reduces the total size of your page, meaning your page loads faster.

Do your images need optimization?


Why should I optimize images?

Images carry a large footprint (compared to HTML/CSS/JS) in terms of your Total Page Size. Think about how you acquired your images:

  • A stock photo website?
  • A camera?
  • A mobile device?
  • A web search?

Most of these images were likely captured in a very high, print-ready quality. Some may have been resized to something more suitable for the Internet, but some aren’t. Most are not optimally compressed and contain extra data that serves no purpose for the user.

Basically, these images are larger in filesize than they need to be.


What happens when you use UNOPTIMIZED images

Using improperly sized, uncompressed images on your website has a high impact on your page load. Here’s what happens:

Improperly sized and uncompressed images take longer to download, resize and render.


1) The browser requests and downloads the image – it’s 2400 x 1350 and 2.5MB!

2) Based on the design of your site, the HTML/CSS resizes the image to fit your thumbnail area of 300 x 169.

3) The browser renders the resized image on your page.


By using unoptimized images, you forced your user to download more data than they needed to. Here’s why:

  • The image only needed to be 300 x 169; you used a 2400 x 1350 image dimension
  • The image was exported at 12/100%/Maximum quality – this level of quality is typically reserved for print
  • …or the image was taken directly from your phone/camera/the Internet – potentially containing metadata, colour profiles and an unnecessarily high quality.

When this happens for more than one image on your site, things can add up and result in a slower performing webpage.



What is image optimization?

For the purposes of this practical guide, we’re going to focus on the filesize issues with unoptimized images. There are other important areas that image optimization affects however (ie. browser re-flows); You can learn more about them here (1, 2).

Simply put; Smaller filesize = Reduced download time = Faster page load. The key concepts of image optimization boil down to image dimensions (visual size, width x height) and compression (image quality, etc).



Image dimensions heavily affect filesize.


Images with large dimensions come with large filesizes. Serving your images at their maximum display size (the largest size they might be on the page given a viewport) ensures the browser doesn’t need to download necessary data, and waste time resizing the image.

Relevant GTmetrix audit: Properly size images



In the most basic definition, lossy compression algorithms attempt to find and reduce redundant pixels within an image. Of course, the more aggressive you are with this, the more pixels you’ll strip from the image, reducing quality.

Uncompressed images retain all their pixel data, and are cleaner and sharper – but larger in filesize.


The simplest example of compression is exporting your images for the web (via Photoshop). This includes selecting the export quality that best balances filesize savings and image quality.

Compressed images are lower in quality – notice the artifacts and reduction of details and colours.


In this case, you are performing lossy compression on your images, as the more you reduce the filesize, the more you reduce the quality of your image. Learn more about lossy compression here.

Lossless compression is a method where your image quality remains absolutely the same, however the data that makes up your image is organized in a more efficient and compact manner, resulting in a smaller file size.

Modern image compressors use highly advanced compression algorithms based on either lossy or lossless methods to compress your images and reduce filesize while retaining image quality.

Relevant GTmetrix audit: Efficiently encode images


More optimization

In addition to dimensions and compression, image optimization also includes stripping out extraneous data that your users don’t need.

Metadata is not visible to your users and therefore should be stripped.


In an image file, there exists layers of data that isn’t seen by the average user. This includes general metadata like EXIF data, colour profile information and date/location.

Removing this data all together from the image leaves only the visible pixel data – the actual data that the user sees, which results in a smaller filesize for the image.


What happens when you use OPTIMIZED images

Properly sized images and compressed images download and render faster.


1) The browser requests and downloads the image – it’s now only 300 x 169 and 68kb!

2) No HTML/CSS resizing is needed, so the browser renders the image as is on your page.

The result is a much faster downloading and rendering of the image(s) on your site.



“Properly sizing images” and the responsive web

So you have a responsive design for your website, and GTmetrix is alerting you to “Properly size images.” Isn’t there a conflict here? You might be asking:

How can my site be responsive if I must serve properly sized images? Won’t my images look low quality at a certain break point?

Since responsive design resizes and scales images, it’s not realistic to serve images in the size they’ll be displayed at, because that viewport can change.

The main goal behind the “Properly size images” audit is to ensure that the served images aren’t drastically out of scale.

A general rule then is to serve images at the maximum display size in your design. To be safe with retina displays, you can scale them up to 2x the maximum display size.

You’ll still need to scale your images with a responsive design.

This will ensure maximum flexibility with responsive designs as well as optimal quality for high-density pixel displays.

There’s also the usage of “srcset” and CMS handling of responsive images that should be detailed, but we will likely be writing a separate article on this. For now, you can read more about “srcset” here.


So how do you optimize images?

This explanatory guide was meant to give you a good understanding of the core concepts behind image optimization. Next in our series, we’ll show you exactly how to compress and scale images correctly so that you can optimize your website’s page size footprint.

Read our Part 2 in this series: How to Optimize Images: A Practical Guide