JPEG Quality

Facebooktwitterlinkedin

Today’s Question: If I understand correctly, the Quality slider in the Export module of Lightroom is the primary controller of file image size. I wonder if you could explain the Quality slider in more detail and what is an ideal image file size (kb) range for optimizing web images in terms of preserving image quality and page load speed across various devices.

Tim’s Quick Answer: The Quality setting for JPEG images relates to the degree of compression applied, which in turn impacts the size of the JPEG image file. A higher setting for Quality results in a larger file size, and a lower setting for Quality results in a smaller file size. For online sharing or other situations where you want to strike a balance between file size and image quality, I recommend a Quality setting of 80% in Lightroom, or a value of “8” (eight) in Photoshop or other applications.

More Detail: Because of the nature of JPEG image compression, it is difficult to predict exactly how large the final file will be. Images with greater detail will generally not compress as well, and thus will have a larger file size when saved as a JPEG file. Images with less detail (more areas that have minimal texture and many pixels of the same or similar color) will have a smaller file size when saved as a JPEG.

JPEG compression essentially involves simplifying the information in the image being saved. Generally speaking this process involves dividing a photo into blocks of sixteen by sixteen pixels (256 pixels per block) and then simplifying the information within those blocks. At a lower the Quality setting, the simplification process will be more aggressive. With more simplification of the image data, the file size is smaller.

One way to think of this is with an illustrative analogy. Imagine that one block within a photo contains only blue pixels. Specifically, every single pixel in that block is exactly the same shade of “sky blue”. Instead of having to repeat “sky blue” as a pixel color for all of the 256 pixels in that block, the information can be saved to the file as “256 sky blue pixels”. Again, this is an over-simplification of what’s actually happening, but it gives you a sense of the process.

This process of simplifying the information within a JPEG using blocks of pixels is a key reason that a low Quality setting results in lower image quality. With stronger compression, there is greater simplification of the information within the image, and the grid structure of the 256-pixel blocks can become visible in the image.

Thus, there is an inverse relationship between file size and image quality. At a higher Quality setting the file size will be larger, but the quality will be greater with less risk of compression artifacts. As noted above, it is difficult to predict the final file size with great precision. Instead, I recommend making your decision based on a determination of the importance of image quality relative to file size.

I recommend using a Quality setting of 80% in Lightroom (8 in other applications) when file size is a key concern. When image quality is the highest priority, I recommend saving in a file format such as TIFF without any destructive compression, or using the highest value for Quality if you need to use a JPEG format to control the final file size.