How to export DXF to PNG?
Posted: 23 Jan 2020, 19:33
I have DXFs that I want to convert to PNG. What's the best option to achieve this?
CADSoftTools - AutoCAD DWG DXF HPGL (PLT) SVG CGM STEP IGES STL SAT viewers, converters and developer tools. Delphi and C# source code.
https://cadsofttools.com/forum/
Code: Select all
function DrawToBitmap(AGraphic: TGraphic): TBitmap;
begin
Result := TBitmap.Create;
Result.Width := AGraphic.Width;
Result.Height := AGraphic.Height;
Result.Canvas.StretchDraw(Rect(0, 0, AGraphic.Width, AGraphic.Height), AGraphic);
end;
Code: Select all
var
vBitmap: TBitmap;
vPNGImage: TPNGImage;
...
vBitmap := DrawToBitmap(CADImage);
vPNGImage := TPNGImage.Create;
vPNGImage.Assign(vBitmap);
Code: Select all
var
sFileName: string;
...
vPNGImage.SaveToFile(sFileName);