Chapter Contents

Previous

Next
MAP_COLORS

MAP_COLORS



Maps colors to the closest colors in the selected color map


Syntax
Details
Example

Syntax

rc=IMGOP(task-id, 'MAP_COLORS'<, option>);
region-id=PICFILL(graphenv-id, type, ulr, ulc,
lrr, lrc, source<, 'MAP_COLORS' <, arguments>>);

option
specifies the order in which the colors are to be mapped. By default, the colors are mapped in an order that is defined by an internal algorithm. Specify 'SAME_ORDER' to force the color map of the image to be in the same order as the selected color map.

Type: Character


Details

MAP_COLORS acts on the currently selected image. Like the DITHER and QUANTIZE commands, MAP_COLORS reduces the number of colors in a color image. Unlike DITHER, MAP_COLORS attempts to choose colors by looking at pixels individually, not in groups. This technique is much less computationally expensive than DITHER, although it does not handle continuous-tone images as well.

Continuous-tone images contain many shades of colors. Because MAP_COLORS maps the colors in an image to their closest colors in the color map, many of the shades of a color re-map to the same color in the color map. This can reduce the detail in the image. For example, a continuous-tone, black-and-white image would contain several shades of gray in addition to black and white. When MAP_COLORS re-maps the colors in the image, the shades of gray are mapped to either black or white, and much of the detail in the image is lost.

Unlike the QUANTIZE command, MAP_COLORS is passed a particular color map to use. Therefore, multiple images can be reduced to the same color map, further reducing the number of colors used in a frame that contains multiple images. The algorithm looks at each pixel in the image and determines the closest color in the color map. This type of algorithm works best for images that are not continuous-tone images, such as charts, cartoon images, and so on.

Specify the option 'SAME_ORDER' if you are mapping several images and you want the color map to be identical for all of them.


Example

Grab the color map of one image and then apply it to another image with the MAP_COLORS command:

rc=imgop(task-id,'READ',image1);
   rc=imgop(task-id,'GRAB_CMAP');
   rc=imgop(task-id,'READ',image2);
   rc=imgop(task-id,'MAP_COLORS');


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.