Ich habe folgendes gemach:
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var
GIF: TGIFImage;
Ext: TGIFGraphicControlExtension;
begin
GIF := TGIFImage.Create;
try
// Convert bitmap to GIF
GIF.Assign(image1.Picture.Bitmap);
// Create an extension to set the transparency flag
Ext := TGIFGraphicControlExtension.Create(GIF.Images[0]);
Ext.Transparent := True;
// Set transparent color to lower left pixel color
Ext.TransparentColorIndex := GIF.Images[0].Pixels[0, GIF.Height-1];
// Do something with the GIF here...
gif.SaveToFile('c:\MyBitmap_trans.GIF');
finally
GIF.Free;
end;
end;
Error: Invalid Pixel coordinates