ImageGear for C and C++ on Windows v19.1 - Updated
IG_IP_color_reduce_median_cut
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_color_reduce_median_cut

This function reduces an image by dividing it into nMaxColors equal-sized squares.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPIIG_IP_color_reduce_median_cut ( 
        HIGEAR hIGear, 
        BOOL bFastRemap, 
        UINT nMaxColors 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
bFastRemap BOOL Set = TRUE for reduction algorithm optimized for speed. Set = FALSE for algorithm optimized for quality.
nMaxColors UINT The maximum number of colors (that is, maximum number of unique pixel values) you want in the resulting image. Must be 16 to 256.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

RGB – 24 bpp.

Sample:

None

Example:

 
Copy Code
HIGEAR hIGear;     /* HIGEAR handle of image */
/* Reduce to 64 colors using median cut algorithm */
IG_IP_color_reduce_median_cut ( hIGear, FALSE, 64 );

Remarks:

The colors of the pixels in each square will be averaged to produce a resulting color. The resulting image will contain only these colors.

See also section in entitled Color Reduction.