Software Development | Image Optimization

Image Optimization

Overview

One concern of frontend web design and development is site performance. A common factor affecting performance is image load time, which is where image optimization comes in: images often account for most of the bytes a page downloads. Optimization is the process of finding the balance between design quality and file size.

Facts from the 2024 Web Almanac (Media chapter):

Basic Steps of Optimization

The original photos you work with are often very large. Scale them down to the largest size actually needed on the page, given the design and layout plan. Most photo editing software supports these basic steps:

  1. Crop the original image to the critical content, keeping in mind design principles such as the rule of thirds and the purpose of the site or section.
  2. Resize the image to the maximum size you actually need in your design. You may also save smaller versions, possibly cropped differently, for smaller views such as phones and tablets.
  3. Reduce the quality of the image to an acceptable level, which reduces its file size.
  4. Save the image in a modern format such as WebP or AVIF. These formats usually produce smaller files than JPEG or PNG at similar quality.

Image optimization is low-hanging fruit: it improves performance without a large investment of time. Additional image handling techniques include:

Measuring Performance / Page Weight

Check the size of the page resources by using the DevTools Network panel. Reload the page with the cache disabled (check Disable cache in the Network panel) or with a hard reload (Ctrl+Shift+R on Windows/Linux, Cmd+Shift+R on macOS). Your course's development standards and assignment rubrics describe the page weight target.

Editing Tools

The following list is not comprehensive, but it provides good options for editing and optimizing images. You may use any tool you wish.

There are many other image tools, including the following:


Optional Resources