Mainstream File Formats

The formats discussed so far are mighty interesting and they all fulfill their own niche purposes. But two formats JPEG and TIFF are the all-stars of digital imagery. You’ll use these formats the most because of their outstanding compression capabilities and almost universal support among graphics applications.

JPEG

The JPEG format is named after the folks who designed it, the Joint Photographic Experts Group. JPEG is the most efficient and essential compression format currently available and is likely to be the compression standard for years to come. JPEG is a lossy compression scheme, which means it sacrifices image quality to conserve space on disk.

You can control how much data is lost during the save operation, however. When you save an image in the JPEG format, you’re greeted with the JPEG Options dialog box (see Figure-1), which grew to include some new options in Version 5.5.

Figure-1: The JPEG Options dialog box provides a total of 12 compression settings, ranging from 0 (heaviest compression) to 12 (best quality).

But the most vital option is the Quality option, which determines how much compression Photoshop applies to your image. Select an option from the Quality pop-up menu or drag the slider triangle from 0 to 12 to specify the quality setting.

Of the named options, Low takes the least space on disk, but distorts the image rather severely; Maximum retains the highest amount of image quality, but consumes more disk space. Of the numbered options, 0 is the most severe compressor and 12 does the least damage.

JPEG evaluates an image in 8 × 8-pixel blocks, using a technique called Adaptive Discrete Cosine Transform (or ADCT, as in “Yes, I’m an acronym ADCT”). It averages the 24-bit value of every pixel in the block (or 8-bit value of every pixel in the case of a grayscale image).

ADCT then stores the average color in the upper-left pixel in the block and assigns the remaining 63 pixels smaller values relative to the average. Next, JPEG divides the block by an 8 × 8 block of its own called the quantization matrix, which homogenizes the pixels’ values by changing as many as possible to zero.

This process saves the majority of disk space, but loses data. When Photoshop opens a JPEG image, it can’t recover the original distinction between the zero pixels, so the pixels become the same, or similar, colors.

Finally, JPEG applies lossless Huffman encoding to translate repeating values to a single symbol. In most instances, I recommend you use JPEG only at the Maximum quality setting (10 or higher), at least until you gain some experience with it.

The smallest amount of JPEG compression saves more space on disk than any non-JPEG compression format and still retains the most essential detail from the original image. Figure-2 shows a grayscale image saved at each of the four compression settings.

Figure-2: Four JPEG settings applied to a single image, with the highest image quality setting illustrated at the upper left and the lowest at the bottom right.

The samples are arranged in rows from highest image quality (upper left) to lowest quality (lower right). Below each sample is the size of the compressed document on disk. Saved in the only moderately compressed native Photoshop format, the image consumes 116K on disk.

From 116K to 28K—the result of the lowest-quality JPEG setting is a remarkable savings, but it comes at a price. I’ve taken the liberty of sharpening the focus of strips in each image so you can see more easily how JPEG averages neighboring pixels to achieve smaller file sizes.

The first strip in each image appears in normal focus, the second strip is sharpened once by choosing Filter>Sharpen>Sharpen More, and the third strip is sharpened twice. I also adjusted the gray levels to make the differences even more pronounced.

You can see that although the lower-image quality setting leads to a dramatic saving in file size, it also excessively gums up the image. The effect, incidentally, is more obvious on screen. Believe me, after you familiarize yourself with JPEG compression, you can spot other people’s overly compressed JPEG images a mile away.

This isn’t something you want to exaggerate in your images. To see the impact of JPEG compression on a full-color image, check out Color Plate 3-2. The original image consumes 693K in the native Photoshop format, but 116K when compressed at the JPEG module’s Maximum setting.

To demonstrate the differences between different settings better, I enlarged one portion of the image and oversharpened another. JPEG is a cumulative compression scheme, meaning that Photoshop recompresses an image every time you save it in the JPEG format.

No disadvantage exists to saving an image to disk repeatedly during a single session, because JPEG always works from the on-screen version. But if you close an image, reopen it, and save it in the JPEG format, you inflict a small amount of damage. Use JPEG sparingly.

In the best of all possible worlds, you should save to the JPEG format only after you finish all work on an image. Even in a pinch, you should apply all filtering effects before saving to JPEG, because these have a habit of exacerbating imperfections in image quality.

JPEG is best used when compressing continuous-tone images (images in which the distinction between immediately neighboring pixels is slight). Any image that includes gradual color transitions, as in a photograph, qualifies for JPEG compression.

JPEG is not the best choice for saving screen shots, line drawings (especially those converted from EPS graphics), and other high-contrast images. These are better served by a lossless compression scheme such as TIFF with LZW. The JPEG format is available when you are saving grayscale, RGB, and CMYK images.

Occupying the bottom half of the JPEG Options dialog box are three radio buttons, designed primarily to optimize JPEG images for the Web. Progressive isn’t applicable to print images, and the Baseline options don’t affect print images enough to make any difference. For now, just select the first option, Baseline (“Standard”), and be done with it.

TIFF

Developed by Aldus in the early days of the Mac to standardize an ever-growing population of scanned images, TIFF (Tagged Image File Format) is the most widely supported image printing format across both the Macintosh and PC platforms. Unlike EPS, it can’t handle object-oriented artwork, and it doesn’t support lossy compression like JPEG.

But, otherwise, it’s unrestricted. In fact, TIFF offers a few tricks of its own that make it very special. In Photoshop, the TIFF format supports up to 24 channels, the maximum number permitted in any image. In fact, TIFF is the only format other than DCS 2.0, “raw,” and the native Photoshop format that can save more than four channels. To save a TIFF file without extra mask channels, deselect the Alpha check box in the Save dialog box.

Even more impressive, TIFF supports multiple layers in Photoshop 6. If you want layers to remain independent when you save the file, select the Layers check box in the Save dialog box.

When you save an image as a TIFF file, Photoshop displays the TIFF Options dialog box (see Figure-3), which offers expanded controls in Version 6:

Figure-3: Photoshop 6 offers a choice of compression schemes for a TIFF file as well as the option to write the file as an image pyramid.

  • Compression: Formerly, you could apply only one form of compression to TIFF files—LZW (Lempel-Ziv-Welch) compression. You now can apply JPEG and ZIP compression in addition to LZW.
  • LZW: Like Huffman encoding (previously described in the “Saving an EPS image” section), LZW digs into the computer code that describes an image and substitutes frequently used codes with shorter equivalents. But instead of substituting characters, as Huffman does, LZW substitutes strings of data.

Because LZW doesn’t so much as touch a pixel in your image, it’s entirely lossless. Most image editors and desktop publishing applications including Illustrator, FreeHand, PageMaker, InDesign, and QuarkXPress—import LZW-compressed TIFF images, but a few still have yet to catch on.

  • ZIP: The problem with LZW (from a programming perspective) is that it’s regulated by a patent. And whenever a bit of technology costs money to use, you can bet somebody out there is trying to come up with a free equivalent. Hence ZIP, a competing lossless compression scheme used in PDF documents.

Why use it? Theoretically, it’s a bit smarter than LZW and can on occasion deliver smaller image files. On the other hand, Photoshop is currently one of the few programs to support ZIP compression in a TIFF file. So unless you discover big savings when using ZIP, I’d stick with LZW until ZIP support becomes more widespread.

  • JPEG: If two lossless compression schemes aren’t enough, the TIFF format also permits you to apply lossy JPEG compression. Long-time Photoshop users may balk at JPEG compression inside TIFF options. After all, one of the major benefits of TIFF is that it ensures optimum image quality; by applying JPEG compression, which results in loss of image data, you defeat the purpose.

But now that TIFF supports layers, JPEG inside TIFF permits you a unique opportunity to cut the size of your layered images files in half. My experience shows that JPEG in TIFF results in only modest loss of data.

And because the JPEG does not affect the transparency mask—which defines the outlines of the layers—the layers continue to exhibit nice, sharp edges.

If names such as Huffman, LZW, and ZIP ring a faint bell, it may be because these are the same compression schemes used by PKzip, WinZIP, and other file compression utilities.

For this reason, using an additional utility to compress a TIFF image that you’ve already compressed using LZW, ZIP, or JPEG makes no sense.

Neither do you want to compress a standard JPEG image, because JPEG takes advantage of Huffman encoding. You may shave off a few K, but this isn’t enough space to make it worth your time and effort.

Also be aware that some programs may gag on compressed TIFF files, regardless of which compression scheme you apply. If an application balks at opening your Photoshop TIFF file, try resaving the file with no compression.

  • Byte Order: Every once in a while, Photoshop chooses to name a straightforward option in the most confusing way possible. Byte Order is a prime example.

No, this option doesn’t have anything to do with how you eat your food. Instead, there are two variations of TIFF, one for the PC and the other for the Mac. I’m sure this has something to do with the arrangement of 8-bit chunks of data, but who cares? You want PC or you want Mac? It’s that simple.

  • Save Image Pyramid: Choose this option to save tiled TIFF files. This variation of the standard TIFF file-saving algorithm divides your image into tiles and then stacks the tiles in a pyramid.

Each level of the pyramid represents your image at a different resolution, with the highest-resolution version serving as the base of the pyramid.

The idea is that an application can use the low-resolution tiles to perform certain image-processing tasks and dig down to the high-resolution version only when absolutely necessary.

When you’re working with very large image files, this approach not only speeds up certain editing tasks but also puts less strain on your computer’s resources. (If you’re familiar with the FlashPix format, the concept is the same.)

Unless you’re saving your image for use in a program that you know supports tiled TIFF images, however, turn this option off. Photoshop itself can’t take advantage of the tiled technology, and many applications can’t open tiled images at all.

  • Save Transparency: If the image contains transparent areas, select this check box to retain the transparency. Otherwise, transparent areas become white.

If you’ve been working with Photoshop for a few years, you may be wondering what happened to the File>Import> QuickEdit command. This feature enabled you to open and edit just a small portion of a large TIFF file.

QuickEdit can’t deal with compressed TIFF files or properly process edits that you make to a layered TIFF file. So Adobe no longer provides QuickEdit on the Photoshop CD and strongly advises against using it to edit Photoshop TIFF files.