What is a JPEG? Everything You Need to Know

JPEG is the most widely used image format in digital photos and images around the globe. The vast majority of digital photos can be stored in this format and are shared with others. This is because the early internet made it necessary to reduce file size to allow faster transfers.

JPEG is an image that uses lossy compression. This means some data may be lost when it is converted from higher-fidelity formats such as RAW or DNG. It was designed with the eye in mind and attempts to reduce the visual difference when data is lost. This is why it is so powerful and ubiquitous.

Table of Contents

How Does JPEG Compress a Photo?

JPEG uses a discrete cosine transform technique to compress photographs. The same compression technique is used for many media types, such as digital images and video. Frequency encoding, which is a form of light and sound in nature, makes it easy to use this method for processing data.

JPEG compression favours frequencies most relevant to the human eye. Since the eye is less sensitive to high-frequency variations, those areas retain less accurate representations, and an 8 by 8-pixel block is used to segment an image into regions with similar colors and brightness.

Information can sometimes be compressed with no loss, such as when using the popular ZIP format to send archived bundles of files over the internet. This can greatly reduce the size of documents and other sparse files that have a large amount of redundant data. However, photographs are often densely packed with information which is hard to separate into repeated components.

That’s why lossy compression is needed to achieve dramatically smaller files. While no changes can be tolerated when decompressing an application or document, visual changes in an image might make little perceptible difference. JPEG is a file format that reduces the size of files while preserving image quality. It can be used to share photos for viewing.

Why is JPEG So Popular?

The early internet was incredibly slow by modern standards. Images were measured in kilobytes, not megabytes. Early dial-up modems used for the internet had a data rate of 56 kilobits-per-second, which is only seven bytes each second. That means a 10-megabyte JPEG photograph would require at least 16. 5 days to completely download. It took several days to download the image. This was to reduce file size, and to avoid waiting for pages to load. Many web pages relied almost entirely on text.

Internet speeds have greatly increased but so have the resolution of images and amount of code required to display a modern website. Add to that the fact that JPEG is deeply embedded into internet standards and it’s easy to understand why it is still the predominant format decades later. JPEG is not the only format that will be available. In fact, JPEG may soon become obsolete.

How Much Space Does JPEG Save?

The amount of space saved by using JPEG compressed images instead of a RAW file or TIFF is enormous, particularly when considering the pace with which images are being uploaded to the internet. Any reduction in file size and bandwidth for a single photograph can be multiplied by hundreds of millions since that’s how many images are shared on social media daily. Even in personal use, JPEG can cut the amount of storage used by 90%.

For a single 10-megabyte photograph, 9 megabytes of storage space can be saved, the upload will be faster and more efficient, and most importantly, every download will benefit from this reduction in power and bandwidth. A popular image that is viewed a million times will collectively save 9 terabytes of bandwidth. This is a simple way to quickly see the impact of this on the internet.

The Downsides of Using JPEG

The purpose of a JPEG image is critically important in determining if it’s an appropriate format to use or not. Since JPEG is optimized for saving photographs, it tends to compress high-frequency data more strongly. In nature, one edge tends to blur into another and that is even true in photographs of manmade structures. The light reflects, bounces and diffuses so much that there are gradations, which can soften edges.

By comparison, computer-generated images can be unnaturally crisp with a large amount of fine detail. A page of text is a perfect example. Using JPEG compression on screenshots would be a bad idea since it would not be able to compress the data well without adding a large number of artifacts.

One of the main downsides to JPEG compression is artifacts in the resulting image.

While viewing a photograph that is stored as a JPEG might be an ideal experience, editing the same image file could result in noticeable artifacts that were not present in the original photograph. Worse still, if a JPEG image is edited and saved again in JPEG format, the compression artifacts will continue to add up with pixelated images and block-shaped noise becoming overwhelmingly obvious.

This loss of image quality every time the JPEG image is recompressed is something known as digital generation loss. This is what it looks like when a JPEG is rotated and saved lossily 0, 100, 200, 500, 900, and 2000 times:

Digital generation loss seen through lossily rotating and saving a JPEG up to 2000 times. Images by Burny.

To minimize the issues of generation loss, images should ideally be edited losslessly before JPEG compression is used at the final step to export a web-ready file.

Finally, JPEG images don’t support transparency. This is not relevant to a normal photograph but it can be useful when you are composing photos. It is possible to save a photo using a mask, alpha channel, or JPEG 150, which is very helpful.

Alternatives to JPEG: JPEG 2000, HEIC, and WebP

JPEG is the leading internet image format and virtually every modern device supports saving and viewing images with this encoding. Although JPEG’s effectiveness was superior to other formats many years ago, it is difficult to get enough support for any new format. That is slowly changing and it might not be long before JPEG is considered a format to avoid.

Every alternative format in this section allows for better compression and a higher quality image. It also includes transparency. The only problem with any of these formats is their widespread popularity.

WebP has risen to become a serious challenger to the dominance of JPEG. While the format might sound unfamiliar, WebP was released by Google as an open-source format in 2010. Providing an alternative and improvement over JPEG, GIF, and PNG images, WebP is the do-everything image format that seems likely to supplant JPEG someday as the first choice for the internet and possibly even for other uses. WebP can store a photograph using lossy compression or lossless compression.

JPEG 2000 is a newer JPEG standard that was completed in the year 2000, as the name implies. It uses a wavelet compression method that is more versatile and can contain multiple resolutions and varying signal-to-noise ratios. It is more difficult to decode images in this format, so it has not been adopted widely as a photographic format. It’s only use has been as a compression video format called Motion JPEG.

Apple made HEIC the primary photo format for the iPhone in 2017 with the release of iOS 11 and every Apple device with updated software can save and view images in this format. Although Apple is responsible for the success of the format, it was created by the MPEG standards Committee. This format is more durable and takes up less space. Although HEIC is available in Android and Windows, it’s not as widespread. It is possible to use the HEIC in Windows and Android.

JPEG’s Many File Extensions: It’s Not Just .jpg

JPEG files usually have a file extension of .jpg, however, .jpeg is not uncommon. Other extensions include .jpe, .jif, .jfif, and .jfi. They all have the exact same file extensions and you can change them. To avoid compatibility problems with other apps,.jpg or.jpeg is the best ending.

JPEG images can also be contained within other file types, such as PDF and Word documents. A JPEG image is automatically decoded when it’s loaded into an editing program. Saving as another format typically removes the JPEG encoding and the image will be recompressed or left uncompressed, according to the format that it’s saved in. This does not automatically remove any artifacts created by the JPEG compression or restore image data that has already been lost.

Who Made JPEG and Why?

JPEG was finalized as a digital image standard by the Joint Photographic Experts Group in 1992. This joint committee is part of larger international standards organizations, ISO/IEC and ITU-T. The work on standardizing photographic quality graphics began in 1983 and began narrowing in on JPEG as a good candidate soon after. The DCT compression algorithm at the core of JPEG and many other media formats was developed by Nasir Ahmed, an electrical engineer, and computer scientist.

The logo of the Joint Photographic Experts Group.

The JPEG digital image standard was created for use in early computers which were primarily text-based at the time and images had a very limited number of colors and low resolution. JPEG began to change that and its growth was perfectly timed to assist with another new technology that exploded in the late 1980s. The benefit of JPEG image compression to bring photos to the internet is immeasurable and is also a great aid to photography in general despite its flaws.

Conclusion

JPEG format is both wonderful and terrible in equal parts and which side takes precedent is largely within the control of the user. JPEG is a great way to save resources. Both storage space as well as bandwidth can be greatly benefited by the compression of images. If care isn’t taken, however, and the format is abused, the resulting photographs will lose their integrity. JPEG artifacts can be removed by careful touch-ups at or close to pixel level. Artificial intelligence and a few other tools can help, but JPEG should only ever be used for sharing and archiving.

Original photographs are best stored in a higher fidelity format and, for important images, an uncompressed format should be considered since it allows the most freedom to use those photos in a variety of ways in the future.


Image credits: Header illustration by Videoplasty.com and licensed under CC-BY-SA 4.0.

Loading...