Image¶
The IMAGE entity (DXF Reference) represents a raster image, the image file itself is
not embedded into the DXF file, it is always a separated file.
The IMAGE entity is like a block reference, it can be used to add the image multiple times
at different locations with different scale and rotation angles. Every IMAGE entity
requires an image definition, see entity ImageDef
.
Ezdxf creates only images in the xy-plan, it’s possible to place images in 3D space,
therefore the Image.dxf.u_pixel
and the Image.dxf.v_pixel
vectors
has to be set accordingly.
Subclass of |
|
DXF type |
|
Factory function |
|
Inherited DXF attributes |
|
Required DXF version |
DXF R2000 ( |
Warning
Do not instantiate entity classes by yourself - always use the provided factory functions!
- class ezdxf.entities.Image¶
-
- dxf.u_pixel¶
U-vector of a single pixel as (x, y, z) tuple. This vector points along the visual bottom of the image, starting at the insertion point.
- dxf.v_pixel¶
V-vector of a single pixel as (x, y, z) tuple. This vector points along the visual left side of the image, starting at the insertion point.
- dxf.image_size¶
Image size in pixels as (x, y) tuple
- dxf.flags¶
Image.SHOW_IMAGE
1
Show image
Image.SHOW_WHEN_NOT_ALIGNED
2
Show image when not aligned with screen
Image.USE_CLIPPING_BOUNDARY
4
Use clipping boundary
Image.USE_TRANSPARENCY
8
Transparency is on
- dxf.clipping¶
Clipping state:
0
clipping off
1
clipping on
- dxf.brightness¶
Brightness value in the range [0, 100], default is 50
- dxf.contrast¶
Contrast value in the range [0, 100], default is 50
- dxf.fade¶
Fade value in the range [0, 100], default is 0
- dxf.clipping_boundary_type¶
1
Rectangular
2
Polygonal
- dxf.count_boundary_points¶
Number of clip boundary vertices, this attribute is maintained by ezdxf.
- dxf.clip_mode¶
0
Outside
1
Inside
requires DXF R2010 or newer
- boundary_path¶
Returns the boundray path in raw form in pixel coordinates.
A list of vertices as pixel coordinates, Two vertices describe a rectangle, lower left corner is (-0.5, -0.5) and upper right corner is (ImageSizeX-0.5, ImageSizeY-0.5), more than two vertices is a polygon as clipping path. All vertices as pixel coordinates. (read/write)
- reset_boundary_path() None ¶
Reset boundary path to the default rectangle [(-0.5, -0.5), (ImageSizeX-0.5, ImageSizeY-0.5)].
- set_boundary_path(vertices: Iterable[UVec]) None ¶
Set boundary path to vertices. Two vertices describe a rectangle (lower left and upper right corner), more than two vertices is a polygon as clipping path.
- pixel_boundary_path() list[Vec2] ¶
Returns the boundary path as closed loop in pixel coordinates. Resolves the simple form of two vertices as a rectangle. The image coordinate system has an inverted y-axis and the top-left corner is (0, 0).
Changed in version 1.2.0: renamed from
boundray_path_ocs()
- boundary_path_wcs() list[Vec3] ¶
Returns the boundary/clipping path in WCS coordinates.
It’s recommended to acquire the clipping path as
Path
object by themake_path()
function:from ezdxf.path import make_path image = ... # get image entity clipping_path = make_path(image)