Hi Nigel
I use this code to reduce the colors each time I click:
procedure TformPreview.mReduceColorsClick(Sender: TObject);
const
ColorThresholds: array[0..6] of Integer = (256, 128, 64, 32, 16, 8, 4);
var
CC, i: Integer;
begin
CC := ImageEnViewPreview.Proc.CalcImageNumColors();
for i := Low(ColorThresholds) to High(ColorThresholds) do
begin
if CC > ColorThresholds[i] then
begin
ImageEnViewPreview.Proc.ConvertTo(ColorThresholds[i], ieOrdered);
Break; // Ensures the loop breaks after applying the first valid conversion
end;
end;
ImageEnViewPreview.Update;
end;
How would you optimize this?