Photoshop

TOPIC APPEARS IN:

Customize the color table for GIF and PNG‑8 images

You use the color table in the Save For Web & Devices dialog box to customize the colors in optimized GIF and PNG‑8 images. Reducing the number of colors often preserves image quality while reducing the file size of the image.

You can add and delete colors in the color table, shift selected colors to web‑safe colors, and lock selected colors to prevent them from being dropped from the palette.

Sort a color table

Choose a sorting order from the Color Table palette menu:

  • Unsorted restores the original sorting order.
  • Sort By Hue sorts by the location of the color on the standard color wheel (expressed as a degree from 0 to 360). Neutral colors are assigned a hue of 0 and located with the reds.
  • Sort By Luminance sorts by the lightness or brightness of a color.
  • Sort By Popularity sorts by the colors’ frequency of occurrence in the image.

Add a new color to the color table

You can add colors that were left out in building the color table. Adding a color to a dynamic table shifts the color in the palette closest to the new color. Adding a color to a fixed or Custom table adds an additional color to the palette.

  1. If any colors are currently selected in the color table, choose Deselect All Colors from the Color Table palette menu to deselect them.
  2. Choose a color by doing one of the following:
    • Click the Eyedropper Color box in the Save For Web & Devices dialog box and choose a color from the color picker.

    • Select the Eyedropper tool in the Save For Web & Devices dialog box and click in the image.

  3. Do one of the following:
    • Click the New Color button  in the color table.

    • Select New Color from the Color Table palette menu.

    • To switch the color table to a Custom palette, hold down Ctrl (Windows) or Command (Mac OS) when you add the new color.

      The new color appears in the color table with a small white square in the lower right corner, indicating that the color is locked. If the color table is dynamic, the original color is displayed in the upper left and the new color is displayed in the lower right.

Select colors in the color table

A white border appears around selected colors in the Color Table.

  • To select a color, click the color in the Color Table.
  • To select multiple colors in the color table, press Shift and click another color. All colors in the rows between the first and second selected colors are selected. To select a nonadjacent group of colors, press Ctrl (Windows) or Command (Mac OS) and click each color that you want to select. The Color Table palette menu also provides commands for selecting colors.
  • To select a color in the preview image, click in the preview with the Save For Web & Devices Eyedropper tool. Shift‑click to select additional colors.
  • To deselect all colors, choose Deselect All Colors from the Color Table palette menu.

Shift a color

You can change a selected color in the color table to any other RGB color value. When you regenerate the optimized image, the selected color changes to the new color wherever it appears in the image.

  1. Double-click the color in the color table to display the default color picker.
  2. Select a color.

    The original color appears at the upper left of the color swatch and the new color at the lower right. The small square at the lower right of the color swatch indicates that the color is locked. If you shift to a web‑safe color, a small white diamond appears at the center of the swatch.

  3. To revert a shifted color to its original color, do one of the following:
    • Double-click the swatch for the shifted color. The original color is selected in the color picker. Click OK to restore the color.

    • To revert all shifted colors in a color table (including web-shifted colors), choose Unshift All Colors from the Color Table palette menu.

Shift colors to the closest web palette equivalent

To protect colors from dithering in a browser, you can shift the colors to their closest equivalents in the web palette. This ensures that the colors won’t dither when displayed in browsers on either Windows or Macintosh operating systems capable of displaying only 256 colors.

  1. Select one or more colors in the optimized image or color table.
  2. Do one of the following:
    • Click the Web Shift button  in the Color Table palette.

    • Choose Shift/Unshift Selected Colors To/From Web Palette from the Color Table palette menu.The original color appears at the upper left of the color swatch and the new color at the lower right. The small white diamond  in the center of the color swatch indicates that the color is web‑safe; the small square at the lower right of the color swatch indicates that the color is locked.

  3. To set a tolerance for shifting, enter a value for Web Snap. A higher value shifts more colors.
  4. To revert web-shifted colors, do one of the following:
    • Select a web-shifted color in the color table and click the Web Shift button  in the Color Table palette.

    • To revert all web-shifted colors in the color table, choose Unshift All Colors from the Color Table palette menu.

Map colors to transparency

You can add transparency to an optimized image by mapping existing colors to transparency.

  1. Select one or more colors in the optimized image or color table.
  2. Do one of the following:
    • Click the Map Transparency button  in the Color Table palette.

    • Choose Map/Unmap Selected Colors To/From Transparent from the Color Table palette menu.

      The transparency grid  appears in half of each mapped color. The small square at the lower right of the color swatch indicates that the color is locked.

  3. To revert transparency to original color, do one of the following:
    • Select the colors you want to revert and click the Map Transparency button  or choose Map/Unmap Selected Colors To/From Transparent from the Color Table palette menu.

    • To revert all transparency-mapped colors, choose Unmap All Transparent Colors.

Lock or unlock a color

You can lock selected colors in the color table to prevent them from being dropped when the number of colors is reduced and to prevent them from dithering in the application.

Note: Locking colors does not prevent them from dithering in a browser.
  1. Select one or more colors in the color table.
  2. Lock the color by doing one of the following:
    • Click the Lock button .

    • Choose Lock/Unlock Selected Colors from the Color Table palette menu.

    A white square  appears in the lower right corner of each locked color.

  3. Unlock the color by doing one of the following:
    • Click the Lock button .

    • Choose Lock/Unlock Selected Colors from the Color Table palette menu.

    The white square disappears from the color swatch.

Delete selected colors

You can delete selected colors from the color table to decrease the image file size. When you delete a color, areas of the optimized image that previously included that color are rerendered using the closest color remaining in the palette.

When you delete a color, the color table automatically changes to a Custom palette. This is because the Adaptive, Perceptual, and Selective palettes automatically add the deleted color back into the palette when you reoptimize the image—the Custom palette does not change when you reoptimize the image.

  1. Select one or more colors in the color table.
  2. Delete the color by doing one of the following:
    • Click the Delete icon .

    • Choose Delete Color from the Color Table palette menu.

Save a color table

You can save color tables from optimized images to use with other images and to load color tables created in other applications. Once you load a new color table into an image, the colors in the optimized image are changed to reflect the colors in the new color table.

  1. Select Save Color Table from the Color Table palette menu.
  2. Name the color table and choose a location where it will be saved. By default, the color table file is given the extension .act (for Adobe Color Table).

    If you want to access the color table when selecting Optimization options for a GIF or PNG image, save the color table in the Optimized Colors folder inside the Photoshop application folder.

  3. Click Save.
    Important: When you reload the table, all shifted colors will appear as full swatches and will be unlocked.

Load a color table

  1. Select Load Color Table from the Color Table palette menu.
  2. Navigate to a file containing the color table you want to load—either an Adobe Color Table (.act) file, an Adobe Color Swatch (.aco) file, or a GIF file (to load the file’s embedded color table).
  3. Click Open.