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

This function reduces a 24-bit image to an 8-bit image while retaining its most popular, or prevalent, colors.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_color_reduce_popularity ( 
        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 Number of colors to which to reduce.

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 octree algorithm   */
IG_IP_color_reduce_popularity ( hIGear, FALSE, 64 );

Remarks:

Use nMaxColors to specify the maximum number of colors wanted in the result.

See also the section in entitled Color Reduction.