Figure 1: 1939 New York World’s Fair, “The World of Tomorrow”, Samuel Gottscho

-autoindex

Given one or more selected images and a count, -autoindex produces new versions of the images composed of just the number of colors given by the count argument, these chosen so that the reduced-color image resembles its original to a fair degree. The reduced-color image may be dithered to further minimize differences between reduced-color and original versions. Use the command if some technical reason constrains the number of colors that can be used in an image or for the artistic effect of a somewhat posterized result.

-autoindex combines -colormap and -index into one step; the convenience of consolidation sacrifices access to the palette created by -colormap. If one discovers after the fact that the palette is needed, run -colormap[…] 0,0 with the image filtered by -autoindex in the selection […] to recover the palette.

The command has the form :

-autoindex   count > 0
  0<= dithering <= 1,
 

method={ O=median-cut | 1=k-means }

  1. count: (integer greater than zero) Sets the number of different colors available to match the original hues in the selected images.
  2. dithering: (float from the closed interval [0, …, 1]) Sets the size of a neighborhood around which the command attempts to match the neighborhood average, rather than a single pixel. With nonzero dithering, the command factors nearby pixels through a kernel containing a dithering pattern (see -convolve). Otherwise, set to zero, it matches pixels without regard to the neighborhood.
  3. method: When False, -autoindex only uses the median-cut method. Otherwise, (True) -autoindex harnesses the k-means clustering algorithm to refine an initial median-cut-based estimate. The extra stage adds some processing overhead.

Technical Note: Color Mapping in G'MIC

Garry Osgood