Website speed is important, not only because
According to
You can monitor the CWV results of any website using the
Largest Contentful Paint (LCP) — how many seconds it takes for the most data-rich element on a page to load. For example, when someone clicks a link for a page with a high-resolution primary image, LCP is how long it takes for the visitor to see the complete picture. Google considers a load time up to 2.5 seconds good, up to 4 seconds “needs improvement,” and anything longer, poor.
First Input Delay (FID) — how many milliseconds it takes for a page to respond to user interaction. For example, clicking a button may invoke JavaScript. If the JavaScript code is complicated or involves prolonged backend communication, it could take longer to execute. The quicker the interaction, the better. 100 milliseconds or less is ideal.
Cumulative Layout Shift (CLS) — CLS is a measure of the largest burst of layout shift scores for every unexpected layout shift that occurs during the entire lifespan of a page. For a simpler illustration, the large hero image loads slightly after other components when a webpage is first loaded. After the user scrolls past it, it finally loads, forcing the surrounding frames of images and text to change position or resize. These kinds of elements can be annoying and distracting. A good score is 0.1 or less.
Images comprise an average of
Let’s look at the mobile experience for the New York Times. For the day we measured, the performance score was 17, far from an acceptable score range (50-89).
When we looked at the Opportunities, nearly half were image-related. And the page load time can be reduced by around 10 seconds with these image optimizations.
The great news is that image processing APIs like imgix can easily optimize images and improve website performance. For this article, we’ll focus on the last 3 techniques, as they can be easily automated using image APIs. We’ll dedicate a separate article on deferring offscreen images, aka. Lazy loading, as it has multiple implementation options and entails more finesse.
As the nytimes.com example shows, the easiest way to improve LCP is by using a next-gen image format. With imgix, you can convert existing files from virtually any format — such as JPG, GIF, PNG — to AVIF or WebP. This reduces file sizes by an average of 60%, if it’s converted from JPEG, and 35% if it’s converted from WebP, with virtually no loss in quality. (To learn more, check out the
Using nytimes.com as an example again, we see that had the images been efficiently encoded, they could save up to 40% in file size. You can automate image compression using imgix, without any impact on visual quality, with one simple URL parameter auto=compress
. Optimizations occur in real time, removing the need to batch process or maintain multiple copies of an image.
In the examples below, the original image has a file size of 3.3MB. The optimized image, which maintains the same visual quality, has a file size of only 215kB, which is 93% smaller than the original. It’s achieved by using three simple transformations - fm=webp&auto=compress&w=2000
.
The imgix
For nytimes.com, they can save an astounding 29 seconds in loading time and up to 78% in file size by properly resizing the images.
Images are often served out much larger than needed for a page. You can dpi
based on a user device, use the
If you want to improve your Core Web Vitals and website performance, image optimization is the most effective method. We hope this article gives you an idea of how important but simple it is to implement these optimization techniques. We will follow up with a separate article on image lazy loading in the coming weeks.
To learn more about imgix, check out our documentation and sandbox
Also published here.