This unit provides several functions needed to reduce the number of colors in an image. Historically image color reduction was necessary to keep files (mostly BMP files) as small as possible. However, with newer image formats that perform efficient image compression (incuding JPG and PNG), image color reduction is now much less frequently needed. One situation in which color reduction is commonly used is when vectorizing raster images (eg when converting raster images to SVG format).
Note: CQ stands for Color Quantization, the process of reducing the number of distinct colors in an image.
uses Image32, Image32_CQ, Image32_BMP; ... var colors: TArrayOfColor32; img: TImage32; essentialColors: TArrayOfColor32; begin img := TImage32.Create; img.LoadFromFile('beetle.bmp'); essentialColors := [clWhite32, clBlack32]; colors := CreatePalette(img, 16, essentialColors); ApplyPalette(img, colors, true); img.SaveToFile('beetle_16.bmp'); img.Free; end;
Copyright ©2019 Angus Johnson - Image32 ver. 1.37 - Documentation last updated on 14-January-2020