문제

Is there a way to convert a WMF picture to GIF or PNG with the Delphi 2009 (or newer) run time libraries? If not, which image conversion library would you recommend?

도움이 되었습니까?

해결책

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top