Chapter Contents

Previous

Next
Image Data Model: _mapColors

Image Data Model: _mapColors



Reduces the number of colors in an image by mapping them to the colors in a color map


Syntax
Details
Example

Syntax

CALL SEND (object-id, '_mapColors', cmap-id<, order>);

Argument Type Description
cmap-id N the identifier of the color-map
order
C an option specifying the order in which the colors are to be mapped. If no order is specified, the colors are mapped in an order 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.


Details

Like _dither and _quantize, this method reduces the number of colors in a color image.

Unlike _dither, _mapColors attempts to choose colors by looking at pixels individually, not in groups. This method is much less computationally expensive than the _dither method, although it does not handle continuous-tone images as well.

Continuous-tone images contain many shades of colors. Because _mapColors maps the colors in an image to their closest colors in the color map, many of the shades of a color would remap to the same color in the color map, thereby reducing 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 _mapColors remaps the colors in the image, the shades of gray would be mapped to either black or white, and much of the detail in the image would be lost.

Unlike the _quantize method, _mapColors is passed a specific color map to use, so multiple images can be reduced to the same color map, further reducing the number of colors used in a frame containing 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 SAME_ORDER if you are mapping several images and you want the color map to be identical for all of them.


Example

This example applies the color map stored in COLMAPID to an image:

call send(imgdat_id, '_mapColors', colmapid,
          'SAME_ORDER');


Chapter Contents

Previous

Next

Top of Page

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