51. Compress an Image Using JPEG Format
Before You Begin
47 About Saving Images
In 47 About Saving Images, you learned that JPEG images are typically photographs or other complex images with lots of colors or variations in tone. Among the chief purposes for the creation of the JPEG format was to achieve very small file sizes for such images; however, the degree of compression you apply to a JPEG image is variablefrom none at all to a level so high you can no longer tell what the image is. The most important point to remember about the JPEG format is that you should not use it for a working file. Instead, use JPEG to save a PSD image in a shareable format only when you're done making changes. Constantly changing and resaving a JPEG file can generate artifacts and other degradations to the image.
Choose File, Save As
In the Editor, open the file you want to convert to JPEG format. The file is probably a PSD-formatted copy of an image to which you've already made changes. Then choose File, Save As from the menu bar. The Save As dialog box appears.
If your photograph contains added text, you'll get better results if you compress the image using JPEG 2000 format. With JPEG format (especially at middle to high compression levels), a lot of artifacts are created around the edges of the text. Yet at these same compression levels, a photograph saved with JPEG format looks fine.
Choose JPEG Format
From the Format drop-down list, choose JPEG.
Select Save Options
Select options as needed. For example, to save the JPEG copy in the catalog and add it to the version set that includes the edited PSD copy and the original file, enable both the Include in the Organizer and Save in Version Set with Original check boxes. See 47 About Saving Images for help in selecting other options. If desired, change the filename displayed in the File name box. Normally, you do not have to do this because the file will automatically have a different file extension than the original file (the file extension changes because you've chosen a different file type).
Before you begin, adjust the image view so that you can clearly see any area of the image you want to preserve after the conversion is made to the limited color palette. For example, you might zoom in on a face, a curved object or bit of text, or any other critical area.
You can also use the Save For Web dialog box to compress your JPEG image by choosing File, Save for Web from the menu. There are a few less compression options there, but you'll find some tools that allow you to zoom in and out, compare the original and the compressed image side by side, and preview the image in your Web browser. If you use the Save for Web command, however, you will not be given an opportunity to save the file in the Organizer or create a version set with the original image.
Click the Save button. If you see a note reminding you that you're saving this image as part of a version set, click OK to continue. The JPEG Options dialog box appears.
Adjust Compression Level
Select the level of compression from the Quality drop down list, such as High. Fine-tune the amount of compression by dragging the slider left (to increase compression and reduce quality) or right (to decrease compression and increase quality).
From the Format Options frame, select a format for the file. Your choice not only affects how the image appears on a user's system when it's downloaded from the Web, but also the final file size. To have the JPEG file appear one line at a time from the top down, select either the Baseline ("Standard") or Baseline Optimized option. With Baseline, the image is compressed in its entirety; Standard uses the original JPEG compression algorithm; Optimized uses a newer algorithm that might not be compatible with the NCSA Mosaic Web browser (which is all but extinct). The Baseline Optimized option produces the smaller file of the two options.
Enable the Preview check box in the JPEG Options dialog box to change the image in the Editor window based on your selections.
Convert Transparent Pixels
The JPEG format does not support transparency. If the original image file contains transparent pixels, select a color to change them to from the Matte drop-down list. Semi-transparent pixels are blended with the color you select to create fully opaque pixels. You can choose Foreground Color, Background Color, White, Black, 50% Gray, or Netscape Gray (a lighter gray) from the list, or select your own color by choosing Custom from the Matte drop-down list and using the Color Picker that appears to select a color to use. To choose a color from the image, just click in the image with the Eyedropper tool. If you choose None from the Matte drop-down list, semi-transparent pixels are blended with white while transparent pixels are simply made white.
At high compression levels, you might not only experience a loss of quality, but also introduce artifacts and other anomalies.
As you make selections, the file size and download times are displayed at the bottom of the JPEG Options dialog box.
Typically, you'll want to set the Matte color to the same color as your Web page so that the nontransparent part of your image can "float" on top of the background seamlessly.
Save the File
When you are satisfied with your choices, click OK to convert the image. The JPEG version of your image is saved to disk, and your original image is left open in the Editor. Click Save on the Shortcuts bar to make sure that your final edits are preserved in the PSD file, then click the Close button on the PSD image to close it as well.