trimesh.path.raster

raster.py

Turn 2D vector paths into raster images using pillow

Functions

rasterize(path, pitch, origin[, resolution, …])

Rasterize a Path2D object into a boolean image (“mode 1”).

trimesh.path.raster.rasterize(path, pitch, origin, resolution=None, fill=True, width=None)

Rasterize a Path2D object into a boolean image (“mode 1”).

Parameters
  • path (Path2D) – Original geometry

  • pitch (float) – Length in model space of a pixel edge

  • 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

Return type

PIL.Image object mode 1