Create bmp with different PixelFormat

Posted in Graphics

Use Image1.Picture.Bitmap.PixelFormat:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Image1.Picture.Bitmap.LoadFromFile('factory.bmp');
  case ComboBox1.ItemIndex of
    1: Image1.Picture.Bitmap.PixelFormat:=pf1bit;
    2: Image1.Picture.Bitmap.PixelFormat:=pf8bit;
    3: Image1.Picture.Bitmap.PixelFormat:=pf16bit;
    4: Image1.Picture.Bitmap.PixelFormat:=pf24bit;
  end;
  Image1.Picture.Bitmap.SaveToFile('factory2.bmp');
end;