首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

问个关于bmp2gif的有关问题

2012-03-21 
问个关于bmp2gif的问题procedure TFormMain.ButtonConvertClick(Sender: TObject)varBitmap: TBitmapGIF

问个关于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之所以转换后效果感觉好些,是因为他生成的图像经过了去杂边,仿色等优化运算,而你的转换代码米有,原理素这个,解决方法不知道,我对图像优化研究不深..............

热点排行