Image rendering in-world

ImageDisplay

An ImageDisplay renders an image file as a display entity in the world. It converts image pixels to colored map-like displays.


Constructor

ImageDisplay(location, image, pixel_size=..., dual_sided=False, dual_side_mode="mirror")

Create and spawn an image display.

dual_side_mode Description
"mirror" Back side is a mirror image
# From file
display = ImageDisplay(
    Location(100, 70, 200, "world"),
    "images/logo.png",
    pixel_size=0.1,
    dual_sided=True
)

# From PIL Image
from PIL import Image
img = Image.new("RGBA", (16, 16), (255, 0, 0, 255))
display = ImageDisplay(Location(100, 70, 200, "world"), img, pixel_size=0.1)

# From raw pixel data
pixels = [(255, 0, 0, 255)] * (16 * 16)
display = ImageDisplay(Location(100, 70, 200, "world"), (16, 16, pixels), pixel_size=0.1)

Methods

teleport

display.teleport(location)

Move the display. This is synchronous.

update

display.update(image)

Update pixel colors without respawning entities.

If the image dimensions differ from the original, the display is destroyed and recreated.

# Update from PIL Image (no file I/O)
img = Image.new("RGBA", (16, 16), (0, 255, 0, 255))
display.update(img)

# Update from raw RGBA tuples (fastest without pre-computing ARGB)
pixels = [(0, 0, 255, 255)] * (16 * 16)
display.update(pixels)

remove

display.remove()

Despawn and destroy the display. This is synchronous.


Notes