pyvista.numpy_to_texture

pyvista.numpy_to_texture#

numpy_to_texture(image)[source]#

Convert a NumPy image array to a pyvista.Texture.

Parameters:
imagenumpy.ndarray

Numpy image array. Texture datatype expected to be np.uint8.

Returns:
pyvista.Texture

PyVista texture.

Examples

Create an all white texture.

>>> import pyvista as pv
>>> import numpy as np
>>> tex_arr = np.ones((1024, 1024, 3), dtype=np.uint8) * 255
>>> tex = pv.numpy_to_texture(tex_arr)