开发者

How can I convert a WMF picture to GIF or PNG with Delphi?

开发者 https://www.devze.com 2022-12-23 07:38 出处:网络
Is there a way to convert a WMF picture to GIF or PNG with the Delphi 2009 (or newer) 开发者_运维知识库run time libraries?PNG is not that hard, Delphi 2009 includes TPNGImage.

Is there a way to convert a WMF picture to GIF or PNG with the Delphi 2009 (or newer) 开发者_运维知识库run time libraries?


PNG is not that hard, Delphi 2009 includes TPNGImage. For GIF you can use GDI+ or the TGifImage component...

Here's the code :

procedure Test;
var
  p : TPicture;
  png : TPngImage;
begin
  try
    p := TPicture.Create;
    p.LoadFromFile('c:\INPUT.WMF');
    png := TPngImage.CreateBlank(COLOR_RGB, 8, p.Width, p.Height);
    png.Canvas.Draw(0,0, p.Graphic);
    png.SaveToFile('C:\OUTPUT.png');
  finally
    Free(p);
    Free(png);
  end;
end;
0

精彩评论

暂无评论...
验证码 换一张
取 消