50. Compress an Image Using GIF Format
Before You Begin
47 About Saving Images
63 Change Color Mode
As you learned in 47 About Saving Images, GIF format is used with images that contain a palette of 256 or fewer colorstypically images with large patches of one color, line art images such as cartoons and illustrations, and images that contain transparent backgrounds. You'll also find the GIF format used to create simple animations such as a flag waving in the breeze.
Dithering A technique for simulating a color whose value does not appear in an image's palette by mixing pixels of the two closest available shades, in either a predefined or mathematical pattern.
Saving a file in GIF format gives you a number of options, such as the total number of colors you want to use (a factor that determines ultimate file size), how you want to simulate colors not in the limited color palette (using a process called dithering), and whether you want transparency. The latter is a sticky issue, not only because there are so many ways you might have varied the transparency within your image (reducing the opacity of a layer, feathering the edge of a selection, or using a brush with a lower opacity setting), but also because GIF supports transparency only in an all-or-nothing manner. (To retain variable transparency, or alpha transparency, save your image in PNG, JPEG 2000, or PSD format.) If you choose not to have transparency in your GIF image, you can choose a color to convert the transparent pixels to. Semi-transparent pixels are blended with this color to make them opaque, whether or not you retain transparency.
Choose File, Save As
In the Editor, open the file you want to convert to GIF format. This file is probably a PSD-formatted copy of an image to which you've already made changes. Choose File, Save As from the menu bar. The Save As dialog box appears.
Before you begin, adjust the image view so that you can clearly see any area of the image you want to preserve when 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.
Set Save Options
From the Format drop-down list, choose CompuServe GIF. If the image contains multiple layers, you can have them appear in order, one after the other, in a simple animation by enabling the Layers as Frames check box. Imagine a book of pictures that seem to move as you flip the pages, and you'll get the idea of an animated GIF. Here, the "pages" are the separate layers in your image.
To save the GIF 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.
Because GIF images typically do not preserve the layers in the original image, the As a Copy option is turned on for all GIF images as a protection against your accidentally overwriting a file that contains layer information.
If you chose the Layers as Frames option in step 2, the Save For Web dialog box appears instead of the Indexed Color dialog box. Select options as described in 63 Change Color Mode, and enable the Animate option to save the image as an animated GIF; choose a speed for the animation from the Frame Delay list. To repeat the animation over and over automatically, enable the Loop option.
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).
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 Indexed Color dialog box appears.
Set Indexed Color Mode Options
In the Indexed Color dialog box, select the options you want to use to reduce the number of colors in this image. You'll find a full description of each of these options in 63 Change Color Mode. Enable the Preview check box in the Indexed Color dialog box to change the image in the Editor window based on your selections. When you're satisfied with the results, click OK. The GIF Options dialog box appears.
Even if you're not creating an animation, you can use the Save For Web dialog box to create your GIF image by choosing File, Save for Web from the menu. There 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, view the current file size and download times, 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.
Set How Image Should Appear and Click OK
In the GIF Options dialog box, choose how you want the image to appear on a user's system when it's downloaded from the Web. To have the GIF file appear one line at a time from the top down, select Normal. To have it appear in several cycles, with details filled in gradually, selected Interlaced. Click OK to convert the image. The GIF 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.