trimesh.path.raster module¶
raster.py¶
Turn 2D vector paths into raster images using pillow
- trimesh.path.raster.rasterize(path: trimesh.path.Path2D, pitch: float | floating | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, origin: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, resolution=None, fill=True, width=None)¶
Rasterize a Path2D object into a boolean image (“mode 1”).
- Parameters:
path (Path2D) – Original geometry
pitch (float or (2,) float) – Length(s) in model space of pixel edges
origin ((2,) float) – Origin position in model space
resolution ((2,) int) – Resolution in pixel space
fill (bool) – If True will return closed regions as filled
width (int) – If not None will draw outline this wide in pixels
- Returns:
raster – Rasterized version of input as mode 1 image
- Return type:
PIL.Image