ChartDirector 5.1 (PHP Edition)

DrawArea.reduceColors


Usage

reduceColors(colorCount [, blackAndWhite ])

Description

Reduces the number of colors in the image.

The colors in the image will be reduced to at most the number of colors specified, which should be 16 - 256. You may also set the image to black and white. In this case, the color count means number of grey levels.

The colors will be reduced by computing an optimal palette for the image. The image will then be converted using the palette based on the current dithering settings (see DrawArea.setDitherMethod).

Arguments

ArgumentDefaultDescription
colorCount(Mandatory)The maximum number of colors that image should have after after reduction. Must be between 16 - 256.
blackAndWhitefalse (zero)A true (non-zero) value means the image will be converted to black and white (with grey levels). A false (zero) value means the image will not be converted to black and white.

Return Value

The actual number of colors the converted image has.