ezdxf
image_path = 'C:/Users/Downloads/home.jpg' with open(image_path, "rb") as image_file: encoded_string = base64.b64encode(image_file.read()).decode('utf-8') base64_image = encoded_string print(base64_image,'base64_image') image_data = b64decode(base64_image) doc = ezdxf.new("R2000") temp_image_path = 'temp_image.jpg' print(image_data,'image_data') with open(temp_image_path, 'wb') as f: f.write(image_data) image = Image.open(temp_image_path) image.show() width, height = 800, 400 my_image_def = doc.add_image_def(filename=temp_image_path, size_in_pixel=(width, height)) msp = doc.modelspace() image_width, image_height = 400, 200 msp.add_image(insert=(2, 1), size_in_units=(image_width, image_height), image_def=my_image_def, rotation=0) dxf_output_path = "new_dxf.dxf" doc.saveas(dxf_output_path) os.remove(temp_image_path)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)