pyvista.Texture.to_array#

Texture.to_array() NumpyArray[float][source]#

Return the texture as an array.

Returns:
numpy.ndarray

Texture as a numpy array.

Notes

The shape of the array’s first two dimensions will be swapped. For example, a (300, 200) image will return an array of (200, 300).

Examples

>>> from pyvista import examples
>>> texture = examples.download_puppy_texture()
>>> texture
Texture (...)
  Components:   3
  Cube Map:     False
  Dimensions:   1600, 1200
>>> texture.to_array().shape
(1200, 1600, 3)
>>> texture.to_array().dtype
dtype('uint8')