read_texture#
- read_texture(filename: str | Path, progress_bar: bool = False) Texture[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 useimageioto read the file.- Parameters:
- Returns:
pyvista.TexturePyVista texture object.
Examples#
Download Python source code | Download Jupyter notebook
Read in an example jpg map file as a texture.
>>> from pathlib import Path
>>> import pyvista as pv
>>> from pyvista import examples
>>> Path(examples.mapfile).name
'2k_earth_daymap.jpg'
>>> texture = pv.read_texture(examples.mapfile)
>>> type(texture)
<class 'pyvista.plotting.texture.Texture'>