Technical explanation of JPG Image Format
JPG, or JPEG, stands for “Joint Photographic Experts Group”. This is a committee that created the standard JPEG format in 1992. The basic concept is this: varying degrees of image compression can create an image of varying file size and quality. A highly compressed JPG image would make a very small file size, but the compression would also create noticeable artifacts in the image. A JPG image that is not very compressed at all, on the other hand, would be a bigger file size, but appear visually higher quality.
Many photographers confuse file size and image size, yet the two are only partly related. For example, a 20 megapixel image could be either a very high-quality JPG file, say, 15-20 megabytes, or it could be a lower quality JPG file, say, 1-5 megabytes. Both would be 20 megapixel images, but one would still be much higher JPG quality.
JPG Image Compression Ratio
JPG compression ratios range from 2.7:1 to 144:1. That is, very little compression to very high compression. This ratio is usually determined on an easier scale, such as 1-12 in Adobe Photoshop, or 1-100 in Adobe Lightroom. In each case, the higher the number, the higher the image quality. (The lower the ratio)
For most casual photography applications, any JPG compression ratio between 50% and 100% quality will produce almost no loss of image quality, depending on the display medium. (print, versus high-definition digital display)
For professional photography, it is common practice to always save JPG images at the absolute highest possible quality, which will produce essentially no loss of image quality discerninble to the human eye, again depending on the display medium.
Lossy Compression: Saving a JPG , and editing a JPG
It is also common practice for professional photographers to never save a JPG file and then re-open that file, perform additional edits in Photoshop or Lightroom, and then re-save the file as a JPG a second time.
This is because, even if the highest possible JPG compression quality is used each time, the lossy nature of the JPG format will still cause the image quality to be worse each time.
It is therefore common practice for professional photographers to capture images in a raw or uncompressed file format, perform all editing in a “lossless” environment such as raw editing and PSD or TIF file formats, and finally save the file to JPG only once, and only when it needs to actually be displayed on the internet or printed on a printer which only accepts JPG files, such as online print labs.
JPG Bit Rate
Part of the reason that JPG images are more prone to quality loss is also due to their bit-depth. No matter how high-quality you set the compression on a JPG file, it will always be an 8-bit file format. 8 bits means, the image itself is “measured” on a scale of just 2^8, or 256 different values for green, red, and blue, or a total of 16,777,216 possible colors. This may seem like a lot, but on a scale of “just” 1-256 for each color, any sort of editing applied is going to become visible in the form of abrupt, unnatural tonal transitions anywhere that the image did not have enough of a smooth gradation to work with.
Comparatively, raw (RAW) images captured by most digital cameras can have 12-bit or even 14-bit file depth, which offer an exponentially greater variety of color possibilities. 12-bit images can have over 4,000 different tones for each color channel, and 14-bit images can have over 16,000 different tones, the latter which yields a whopping 28 billion color combinations. Such incredible range of color may only give a noticeable difference when performing very aggressive editing, however the difference between 8-bit JPG and 12-bit raw is often a staggering one, with even minimal “preservation” applied to either highlights or shadows.