How to add image transparency in a orthomosaic inside the .dxf #500
Unanswered
Marcelo5444
asked this question in
Issues
Replies: 1 comment
-
This depends on the capabilities of the DXF viewer or CAD application. The DXF file just references the image. Just make sure to set the transparency flag of the IMAGE entity: import ezdxf
import os
IMAGE_PATH = "your_image.tif"
ABS_IMAGE_PATH = os.path.abspath(IMAGE_PATH)
doc = ezdxf.new("R2004") # image requires the DXF 2000 or newer format
# image definition is like a block definition:
my_image_def = doc.add_image_def(
filename=ABS_IMAGE_PATH, size_in_pixel=(640, 360)
)
# use Pillow or any other image library to detect the image size in pixels!
msp = doc.modelspace()
image = msp.add_image(
image_def=my_image_def, insert=(2, 1), size_in_units=(6.4, 3.6), rotation=0
)
image.set_flag_state(ezdxf.const.IMAGE_TRANSPARENCY_IS_ON, True)
doc.saveas("image.dxf") Most likely the image will not show up in AutoCAD, see the how-to section https://ezdxf.mozman.at/docs/howto/viewer.html#show-images-xrefs-on-loading-in-autocad |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, first of all, thanks for the ezdxf package, i have been using it a lot lately.
I have a orthomosaic (.tif) or (.ecw) with 4 bands 3 RGB and 1 transparency (0-255) Is there a way to use this transparency inside the dxf?
Beta Was this translation helpful? Give feedback.
All reactions