write_png: Write a rendered image to a PNG file

View source: R/image_export.R

write_pngR Documentation

Write a rendered image to a PNG file

Description

Writes the output of render_mesh() or render_scene() to a PNG file using the built-in C++ PNG writer (stb_image_write). No additional R packages are required.

Usage

write_png(image, filename)

Arguments

image

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

filename

Output PNG file path.

Value

No return value; called for side effects.

Examples

mesh <- generate_cuboid(c(0, 0, 0), c(1, 1, 1))
img <- render_mesh(mesh$vertices, mesh$triangles)
tmp_file <- tempfile(fileext = ".png")
write_png(img, tmp_file)


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