colormap

Contents

AllocateImageColormap

Synopsis

unsigned int AllocateImageColormap( Image *image, const unsigned long colors );

Description

AllocateImageColormap() allocates an image colormap and initializes it to a linear gray colorspace with increasing intensity. If the image already has a colormap, it is replaced. AllocateImageColormap() returns True if successful, otherwise False if there is not enough memory.

The format of the AllocateImageColormap method is:

unsigned int AllocateImageColormap( Image *image, const unsigned long colors );
image:
The image.
colors:
The number of colors in the image colormap.

CycleColormapImage

Synopsis

CycleColormapImage( Image *image, const int amount );

Description

CycleColormap() displaces an image's colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychodelic effect.

The format of the CycleColormapImage method is:

CycleColormapImage( Image *image, const int amount );

A description of each parameter follows:

image:
The image.
amount:
Offset the colormap this much.

ReplaceImageColormap

Synopsis

MagickPassFail ReplaceImageColormap( Image *image, const PixelPacket *colormap,
                                     const unsigned int colors );

Description

ReplaceImageColormap() replaces an existing image colormap with a new image colormap. The new image colormap is expected to contain all of the colors from the existing colormap. The existing colormap indexes are adjusted to conform with positions in the new colormap. If the new colormap contains duplicate entries, then the associated colormap index will point to the first entry found in the colormap and other matching entries will not be used. MagickPass is returned if the operation is successful, otherwise MagickFail is returned, and image->exception is updated with the cause of the failure.

This function is useful in case colormap entries need to match across multiple images or otherwise occupy specific locations.

The format of the ReplaceImageColormap method is:

MagickPassFail ReplaceImageColormap( Image *image, const PixelPacket *colormap,
                                     const unsigned int colors );
image:
image in which to replace colormap.
colormap:
new colormap.
colors:
number of colors in new colormap.