pygfx.objects.Image

class pygfx.objects.Image(geometry: Geometry | None = None, material: Material | None = None, *, visible: bool = True, render_order: float = 0, render_mask: str | int = 'auto', name: str = '')

Bases: WorldObject

A 2D image.

The geometry for this object consists only of geometry.grid: a texture with the 2D data.

If no colormap is applied to the material, the data are interpreted as colors in sRGB space. To use physical space instead, set the texture’s colorspace property to "physical".

The picking info of an Image (the result of renderer.get_pick_info()) will for most materials include index (tuple of 2 int), and pixel_coord (tuple of float subpixel coordinates).

Parameters:
  • geometry (Geometry) – The data defining the shape of the object. Must contain at least a “grid” attribute for a 2D texture.

  • material (Material) – The data defining the appearance of the object.

  • visible (bool) – Whether the object is visible.

  • render_order (int) – The render order (when applicable for the renderer’s blend mode).

  • render_mask (str) – Determines the render passes that the object is rendered in. It’s recommended to let the renderer decide, using “auto”.

  • position (Vector) – The position of the object in the world. Default (0, 0, 0).

Examples

Colormap Image

Colormap Image

Geometry Image

Geometry Image

Image Click Events

Image Click Events

Image with another image overlaid

Image with another image overlaid

Image with Points Overlaid

Image with Points Overlaid

Displaying an image in a scene

Displaying an image in a scene

Labelled Image Grid

Labelled Image Grid

Measure distances in 2D

Measure distances in 2D

Paint to a texture

Paint to a texture

Paint to a texture directly

Paint to a texture directly

Physical Color

Physical Color

Subplots Video

Subplots Video

Show Image

Show Image

Synced Video Rendering

Synced Video Rendering

Video YUV

Video YUV

A Tool to Compare Two Images of Identical Shapes

A Tool to Compare Two Images of Identical Shapes

Interactive Segmentation with SAM2

Interactive Segmentation with SAM2

Image Material

Image Material

Validate Colormap

Validate Colormap

Validate send_data

Validate send_data

srgb texture colorspace

srgb texture colorspace

Tiny Image Validation

Tiny Image Validation