BMP转GIF问题?(20分)

  • 主题发起人 主题发起人 loxtln
  • 开始时间 开始时间
L

loxtln

Unregistered / Unconfirmed
GUEST, unregistred user!
请教如何将一个BMP图像转为GIF格式,并能灵活设置压缩比?
 
用gif控件,没法设压缩比
 
用TGifImage ,没有的话去 cakk.126.cm 下载

procedure TFormMain.ButtonConvertClick(Sender: TObject);
var
Bitmap : TBitmap;
GIF : TGIFImage;
begin
ButtonConvert.Enabled := False;
try
Bitmap := TBitmap.Create;
try
// Load the bitmap that will be converted
Bitmap.LoadFromFile(ExtractFIlePath(Application.ExeName)+'test.bmp');
// Display the bitmap
ImageBMP.Picture.Assign(Bitmap);
// Clear previous GIF view
ImageGIF.Picture.Assign(nil);

ShowMessage('This demo loads a bitmap from the file TEST.BMP,'+#13+
'converts it to a GIF and saves it as TEST.GIF');

GIF := TGIFImage.Create;
try
GIF.OnProgress := OnProgress;
// Convert the bitmap to a GIF
GIF.Assign(Bitmap);
// Save the GIF
GIF.SaveToFile('test.gif');
// Display the GIF
ImageGIF.Picture.Assign(GIF);
finally
GIF.Free;
end;
finally
Bitmap.Free;
end;
finally
ButtonConvert.Enabled := True;
end;
end;
 
有好多控件呢
 
接受答案了.
 
后退
顶部