Skip to main content

raygeo.image.render

Functions

geometry_to_image()

geometry_to_image(
strokes: geo.Geometry,
fills: geo.Geometry,
size_mm: tuple[float, float],
dpi: float = 96,
) -> numpy.ndarray

Rasterise vector geometry into an RGBA uint8 image.

Converts mm‑space Y‑up geometry into a pixel buffer (Y‑down, origin top‑left) at the given dpi.

Uses basic anti-aliasing for the wire‑frame strokes, and scan‑line filling for the closed polygons.

ParameterTypeDescription
strokesgeo.GeometryWire‑frame paths (stroked in black).
fillsgeo.GeometryClosed polygons (scan‑line filled in light gray).
size_mmtuple[float, float]Physical size (width, height) in mm.
dpifloat = 96Output resolution in dots per inch (default 96).
Returnsnumpy.ndarraynumpy.ndarray with shape (H, W, 4) and dtype uint8.

Vector geometry rasterised into an RGBA pixel buffer

Vector geometry rasterised into an RGBA pixel buffer