?

JPEG - Joint Photographic Experts Group

Image File Formats - LegalScans

(.JPG file extension, pronounced Jay Peg)

This is the right format for those photo images which must be very small files, for example, for web sites or for email. The JPG file is wonderfully small, often compressed by 90%, or to only 1/10 of the size of the original data, which is very good when modems are involved. However, this fantastic compression efficiency comes with a high price. JPG uses lossy compression (lossy meaning "with losses"). Lossy means that some image quality is lost when the JPG data is compressed and saved, and this quality can never be recovered.

Most other file compression methods are lossless, which means "fully recoverable". Lossless compression always returns the original data, bit-for-bit identical without any question about differences (losses). We are used to saving data to a file, and getting it all back when we next open that file. Our Word and Excel documents, our Quicken data, any data at all, we cannot imagine NOT getting back exactly the original data. TIF, PNG, GIF, BMP and most other image file formats are lossless too. This integrity requirement does limit efficiency, limiting compression of photo image data to maybe only 10% to 40% reduction in practice (graphics can be smaller). But most compression methods have full lossless recoverability as the first requirement.

JPG files don't work that way. JPG is an exception. JPG compression is not lossless. JPG compression is lossy. Lossy means "with losses" to image quality. JPG compression has very high efficiency (relatively tiny files) because it is intentionally designed to be lossy, designed to give very small files without the requirement for full recoverability. JPG modifies the image pixel data (color values) to be more convenient for its compression method. Detail that doesn't compress well can be ignored (removed instead of retained). This allows amazing size reductions on the remainder, but when we open the file and expand the data to access it again, it is no longer the same data as before. This lost data is like lost purity or integrity. It can vary in degree, it can be fairly good, but it is always unrecoverable corruption of the data. This makes JPG be quite different from all the other usual file format choices.

There are times and places this compromise is an advantage. Web pages and email files need to be very small, to be fast through the modem, and some uses may not need maximum quality. In some cases, we are willing to compromise quality for size, sacrificing for the better good. And this is the purpose of JPG.

There is no magic answer providing both high compression and high quality. We don't get something for nothing, and the small size has a cost in quality. Still, mild quality losses may sometimes be acceptable for less critical purposes. The sample JPG images on next page show the kind of problem to expect from excessive compression.

Even worse, more quality is lost every time the JPG file is compressed and saved again, so ever editing a JPG image is a questionable decision. You should instead just discard the old JPG file and start over from your archived lossless TIF master, and save that change as the new JPG copy you need.

JPG compression can be adjusted to be better quality in a larger file, or to be lesser quality in a smaller file. When you save a JPG file, your FILE - SAVE AS dialog box should have an option for the degree of file compression. Some programs (Photoshop, PhotoImpact, PhotoDeluxe) call it JPG Quality. Other programs (Paint Shop Pro, Corel, Micrografx) call it JPG Compression. Same thing, but Quality runs numerically the opposite direction from Compression. High Quality corresponds to Low Compression. Typical values might be 80 Quality, or 20 Compression. These numbers are relative and have no absolute meaning. Compression in one program will vary from another even at the same number. The number is also not a percentage of anything, and Quality 100 does NOT mean no compression, it is just an arbitrary starting point. JPG will always compress, and Quality 90 is not so different from Quality 100 in practice. There's very little improvement over 95.

Individual image detail greatly affects compressibility. Large featureless areas (skies, walls, etc.) compress much better (smaller) than images containing much busy detail all over. Images with different content, all the same size in pixels and using the same JPG quality setting, may vary substantially in file size, half or perhaps even double the average size.

So the file size is only a very crude indicator of JPG quality, but for many images, file sizes smaller than 10% of the uncompressed image size often show excessive artifacts. A JPG file size only 10% of the bytes of that image's size in memory would be 10:1 compression, and this is the general ballpark for a fair tradeoff of quality vs. file size for color images of web page quality. Color compresses better than grayscale files, which must be larger, perhaps 20% of original size. These are very rough guidelines, your image, your photo program, your purpose, and your personal criteria or tolerance will all be different.

JPG is mathematically complex and requires considerable CPU processing power to decompress an image. JPG also allows several parameters, and programs don't all use the same JPG rules. Programs vary, some programs take shortcuts to load JPG faster but with less quality (browsers for example), and other programs load JPG slower with better quality. Final image quality can depend on the image details, on the degree of compression, on the method used by the compressing JPG program, and on the method used by the viewing JPG program.

JPG normally should not be used for text or graphic images. It blurs the sharp edges too much, and the results are typically poor. TIF, PNG, and GIF are vastly better for line art or graphic images, and these cases (solid colors instead of continuous tones) normally compress to a smaller file than JPG. JPG cannot contain line art or indexed color anyway. JPG requires 8 bit grayscale or 24 bit color. However for continuous tone photo images, as opposed to text or graphics, then files with high JPG Quality (low compression) are normally acceptable for viewing (read-only purposes), and the small file size is extremely desirable for modems.

But due to quality concerns, JPG compression is generally NOT suitable for archiving the important master copy of your image. With only mild compression, it might view OK, but you should grit your teeth, hold your breath, and cross your fingers for luck, if you ever have the need to modify and save a JPG file again. Because this will lower the quality of that image even more, every time you save the file. By "save", I mean to select the FILE - SAVE or FILE - SAVE AS menu with JPG format from an image program. That step does the JPG compression.

You won't gain any quality by converting JPG to TIF now, because that image copy will still contain the JPG artifacts it had before. It is part of the image now, there is no way to improve it again. However, if you do need to edit a JPG, then saving it as TIF will prevent adding more artifacts by not doing another JPG Save, so TIF would be a good plan then.

Note again that MOST other file formats (TIF, PNG, GIF, BMP) use lossless compression. These files are larger than JPG because they use milder, fully recoverable (lossless) compression to carefully preserve all of the original image data. It is a matter of data integrity instead of compression efficiency, and these other file formats remain full quality at all times, no matter how many times we might save them to a file. So we can save those as many times as we wish, and it always saves the full lossless quality. This is what we want for a master copy of the image.

The small JPG file size is great in its place, but it has a big price of reduced quality. There are proper times and places one would use it, and also major reasons one would not. There's nothing wrong with creating a JPG image using a moderate to high Quality factor to put a photo image on a web page or to send it via email. It's the only practical way. However there is an additional quality loss when we try to edit and save that JPG file a second time, so JPG is usually inappropriate for important archived master copies. The risk if you make this mistake now is that you cannot undo it in the future, so now is the best time to understand the situation.

A new JPEG 2000 file format is coming soon, available now but still rare. It uses wavelet compression, quite different but still lossy (said to be better quality). It is appearing now in some of the newest program versions, with various file extensions like .jp2, .jpx, .jpc, but web browsers will have to add support for it before it can become very popular.


?