读书人

问个关于bmp2gif的有关问题

发布时间: 2012-03-21 13:33:14 作者: rapoo

问个关于bmp2gif的问题
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);



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;

利用上面的一小段倒是能把BMP转成gif,
但是转的gif质量很差,问问大侠们,有没有什么方法让转的gif质量好些,
有什么其他的DLL或者控件转gif失真少些么?或者哪位有代码看下不胜感激。

[解决办法]
先用其它软件将BMP转换一下,转成GIF,看下失真效果,再确定是代码转换问题还是压根转换就肯定产生严重失真。
[解决办法]
gif本身就是256色的,你把一个真彩的bmp转成gif,效果好的了才怪
ps之所以转换后效果感觉好些,是因为他生成的图像经过了去杂边,仿色等优化运算,而你的转换代码米有,原理素这个,解决方法不知道,我对图像优化研究不深..............

读书人网 >.NET

热点推荐