image_to_array: Convert a rendered image to an RGBA array

View source: R/image_export.R

image_to_arrayR Documentation

Convert a rendered image to an RGBA array

Description

Converts the output of render_mesh() or render_scene() into a 3-dimensional R array of dimensions (height x width x 4) with RGBA channels.

Usage

image_to_array(image)

Arguments

image

An image list returned by render_mesh() or render_scene().

Value

A 3D array of dimensions (height, width, 4) with values in [0, 1].

Examples

mesh <- generate_cuboid(c(0, 0, 0), c(1, 1, 1))
img <- render_mesh(mesh$vertices, mesh$triangles)
arr <- image_to_array(img)
dim(arr)  # height x width x 4


scimesh documentation built on Aug. 9, 2026, 9:07 a.m.