pyvista.read_texture#

read_texture(filename, progress_bar=False)[source]#

Load a texture from an image file.

Will attempt to read any file type supported by vtk, however if it fails, it will attempt to use imageio to read the file.

Parameters:
filenamestr

The path of the texture file to read.

progress_barbool, default: False

Optionally show a progress bar.

Returns:
pyvista.Texture

PyVista texture object.

Examples

Read in an example jpg map file as a texture.

>>> import os
>>> import pyvista as pv
>>> from pyvista import examples
>>> os.path.basename(examples.mapfile)
'2k_earth_daymap.jpg'
>>> texture = pv.read_texture(examples.mapfile)
>>> type(texture)
<class 'pyvista.plotting.texture.Texture'>