Issue with image in dxf


Hello daniel,
I have recently encoutered few files with invalid image in them. Example is attached. I looked into it and this is what I found:
  • dxf does contain zero vectors U and V for image
  • this causes issues with normal vector computation and rotation computation
I do not know how can this happen. Maybe this comes from some bugy cad application, but I will have to prepare solution for this. If you want I can send patch here as well.


file attachments


haplokuon wrote Jun 5 at 6:07 PM

The UV vectors of the Image entity define how to map a raster image into a vector object, and they should be different than zero. If this is the case it will result in an image that has zero height and width with undefined normal and rotation. And, therefore, AutoCad should treat this case as an error, but it has no problem importing such a dxf. The resulting imported image will have zero height and width, what is expected. Now, the problem with them is that, since AutoCad, through its UI, does not allow to set the width and/or the height of an Image to zero, they become unusable, it will not allow to change its size.

So, the best solution is to just skip those images when they are imported.

These UV vectors should also be not parallel and, better if they are also perpendicular, even thought not necessary strictly speaking.

Who knows what that application was trying to achieve when exporting such image, it has no sense.