MagickCore, C API: Colormap Methods @ ImageMagick
Author: ImageMagick Studio LLC
Description: ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
Keywords: magickcore, c, api:, colormap, methods, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert

AcquireImageColormap • CycleColormap

## AcquireImageColormap

AcquireImageColormap() allocates an image colormap and initializes it to a linear gray colorspace. If the image already has a colormap, it is replaced. AcquireImageColormap() returns MagickTrue if successful, otherwise MagickFalse if there is not enough memory.

The format of the AcquireImageColormap method is:

    MagickBooleanType AcquireImageColormap(Image *image,const size_t colors,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
colors
  the number of colors in the image colormap.
exception
  return any errors or warnings in this structure.

## CycleColormap

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.

WARNING: this assumes an images colormap is in a well know and defined order. Currently Imagemagick has no way of setting that order.

The format of the CycleColormapImage method is:

    MagickBooleanType CycleColormapImage(Image *image,const ssize_t displace,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
displace
  displace the colormap this amount.
exception
  return any errors or warnings in this structure.