Well I'm stuck in a problem of converting my jpg file into dxf file in Python. After dxf file is created I want to open it in MS Visio which is drawing tool for making various types of diagrams. I've found a code in Python which is used to convert jpg into dxf file but the dxf file which is being created is empty. The image which was present in jpg was not been shown in dxf when I open dxf file in any online dxf viewer.
Here is my code below:
import ezdxf
doc = ezdxf.new("R2000")
img_file="n1.jpeg"
my_image_def = doc.add_image_def(filename=img_file, size_in_pixel=(930, 2500))
msp = doc.modelspace()
msp.add_image(
insert=(2, 1),
size_in_units=(6.4, 3.6),
image_def=my_image_def,
rotation=0)
msp.add_image(
insert=(4, 5),
size_in_units=(3.2, 1.8),
image_def=my_image_def,
rotation=30)
image_defs = doc.objects.query("IMAGEDEF")
doc.saveas("dxf.dxf")
Kindly if anybody sort this problem out and make the image in dxf file visible. Thanks!
The above image I uploaded as a test image, I want that image to be converted into DXF file in python. Anybody can help....!