![]() |
![]() |
![]() |
function TrimPalette(const palette: TArrayOfColor32; var colorFrequency: TArrayOfInteger; newSize: integer): TArrayOfColor32; overload;
function TrimPalette(const palette: TArrayOfColor32; var colorFrequency: TArrayOfInteger; minFrac: double): TArrayOfColor32; overload;
Either:
Reduces the palette size by removing (in order) the least frequently used colors until newSize is reached**.
Or:
Reduces the palette size by removing palette entries with palette frequencies that are less that then specified minimum fraction of the average palette frequency**.
For example, given a palette with 256 colors that was constructed from an image with 256,000 colored pixels, then the average palette frequency would be 1000. If 'minFrac' was 0.1, then palette entries with a frequency less than 100 (ie 1000 * 0.1) would be removed.
**Assumes that CreatePaletteEx has been called previously, and the returned colorFrequency is passed unaltered to this function.
Copyright ©2019 Angus Johnson - Image32 ver. 1.54 - Documentation last updated on 7-November-2020