Reg. Insert Image in DXF Document

Oct 10, 2013 at 7:52 AM
Hi Everyone,

Is it possible to insert any image(.bmp,.jpeg etc. ) in the DXF Docuement ?
Coordinator
Oct 12, 2013 at 7:22 PM
Yes, you can use the Image entity for this. In the TestDxfDocument you will find an example on how to do it, take a look at the WriteImage method. Here you have a piece of code:
ImageDef imageDef = new ImageDef("myImage.jpg");
Image image = new Image(imageDef, Vector3.Zero);
DxfDocument dxf = new DxfDocument();
dxf.AddEntity(image);
Daniel
Jun 25, 2014 at 3:20 AM
Hi, Thanks for your excellent work.
In my Autocad, it just display region with name of file.
It does not display image.
Thanks
Jun 25, 2014 at 4:25 AM
Now, I know why.
I must set the full directory for image file.
Thanks
Coordinator
Jun 25, 2014 at 3:26 PM
Actually the dxf permits the use of both relative and absolute paths, but for unknown reasons, sometimes, it complains when relative paths are passed to the dxf. I guess this is a bug with AutoCad, in any case, reloading the external references should fix the problem.

Daniel
Aug 25, 2015 at 11:44 AM
Hi,

Do you plan to add support for embeding images in DXF files (if that is technically possible).

I would like to create Image from Stream eg.:
var stream = new System.IO.MemoryStream(bytes);
var imageDef1 = new ImageDef(stream);
var image1 = new Image(imageDef1, Vector3.Zero, 0, 0);
Coordinator
Aug 25, 2015 at 5:38 PM
The dxf specification of the Image entity only supports externally referenced bitmaps, it is not possible to embed them.

Daniel