function CreatePaletteEx(image: TImage32; MaxColors: integer; out colorFrequency: TArrayOfInteger): TArrayOfColor32;

Creates the optimal palette for the specified number of colors.

In addition, the function returns the color frequency for each palette entry (ignoring semi-transparent pixels). Also, the length of colorFrequency will always be one more than the length of the returned palette as the final entry contains the sum total of all colorFrequency entries.

See Also