Table of contents of the article:
Did you know that slow loading times are one of the most common challenges for having a good User Experience? Here are some techniques to speed up load times and make your website much more intuitive.
The JPEG image format is one of the image formats most commonly used on the Web. The format is often used for colorful and complex images such as photographs. The JPEG specification includes a range of valid file extensions, however the most common are .jpg and .jpeg.
JPEG stands for Joint Photographic Experts Group and was developed especially for photos. JPEG will compress a photo or image with gradations more efficiently than PNGS. When saving JPEG files, you can save the image with different quality levels to reduce the file size. As mentioned, you can save the photo as a JPEG or progressive JPEG depending on your audience and goal. You may also see references to JPEG2000, although this format has better compression, it is not supported by all browsers.
Regardless of the extension used, all JPEG images will be treated in much the same way. Although not all JPEG images are created equally. There is a lesser known setting in specifying image formats. This setting, called Progressive Mode, can dramatically improve the experience of using JPEG files on the web.
Normal JPEG vs Progressive JPEG
The biggest defining factor of an image format is generally compression - methods vary widely. In fact it is what makes some formats more suitable than others depending on how the image is used. Even within the JPEG format you can get extremely variable results depending on the export settings used.
In most imaging programs, the type of JPEG created when saving would be considered “Baseline”. To be brief, the best way to imagine baseline or baseline mode is for the image to start from the top and be interpreted line by line. Moving the image down each line of pixels at a time as it compresses and / or displays the image.
For those who still remember the fundamentals of old GIFs. Progressive JPEG format can be understood as the equivalent of Intelaced GIF format.
An interlaced GIF does not show its scan line linearly from top to bottom, but instead rearranges it so that the content of the GIF becomes clear even before it finishes loading. For example, the GIF viewer can display lines at the top of the image, then in the center, then at the end, and will continue to fill in the blanks until the image is fully loaded.
Progressive JPEGs are similar to interlaced GIFs, but their rendering scheme is generally superior to that used with GIFs. With some applications it is also possible to change the order in which scanlines are displayed. Unlike interlaced GIFs, progressive JPEGs are often smaller than their basic counterparts.
The trade-off here is that it only loads some of the image data at a time. This means that the image will load at full size with a pixelated appearance and will become clearer as it loads.
See it in action
Sometimes the best way to understand something is to see it in action. So that's exactly what we're going to do here, we'll have the exact same image saved as both types of JPEGs to compare.
So let's start by taking a high quality image to test with; in our case we will use a Pexels photo of some sleeping kittens. Since this is a high resolution image, we will resize it a bit before our test, so we will resize it by about half. Now that it has been resized, we will export two versions of the image, one in baseline and one progressive. (Both images will use the exact same settings other than this option, and we're using GIMP to create the images.)
So even though these images are quite large, it is sometimes difficult to see the difference in their upload process. Below each image is a “timeline” view of how the image is loaded over time. Keep in mind that the timeline visualization provided is heavily dramatized to illustrate the idea. If you were to load the page without no local cache, you may actually see this behavior when loading images!
Advantages of progressive JPEG
On a website, progressive JPEG can improve the user experience. Although blurry, visitors can already see the entire image at first glance. Additionally, being generally smaller in size, progressive JPEG can also reduce the use of resources such as bandwidth and disk space, helping your website load faster.
Popular browsers, such as Firefox and Chrome, also support progressive images. But if you are using an older version of Internet Explorer (before Windows 7), be sure to install the latest update to enable the feature.
If you want the images on your website to load faster, it is best to change them to the progressive JPEG format even if you use modern formats like webp or AVIF you'll always have to serve old JPEG formats as fallbacks for browsers that don't yet support them.