Manipulating Dxf images
Contents
[
Hide
]
Aspose.Imaging for Python via .NET supports export to Dxf format from vectorized formats(i.e. SVG, EPS, etc). Raster images Dxf does not support.
Export eps to dxf image
Saving of eps image to dxf provided:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.pycore as aspycore | |
from aspose.imaging import Image | |
from aspose.imaging.imageoptions import DxfOptions | |
import os | |
if 'TEMPLATE_DIR' in os.environ: | |
templates_folder = os.environ['TEMPLATE_DIR'] | |
else: | |
templates_folder = r"C:\Users\USER\Downloads\templates" | |
delete_output = 'SAVE_OUTPUT' not in os.environ | |
data_dir = templates_folder | |
output_file_path = os.path.join(data_dir, "result.dxf") | |
with Image.load(os.path.join(data_dir, "template.eps")) as image: | |
options = DxfOptions() | |
options.text_as_lines = True | |
options.convert_text_beziers = True | |
options.bezier_point_count = 20 | |
image.save(output_file_path, options) | |
if delete_output: | |
os.remove(output_file_path) |