pyvista.read_texture#
- read_texture(filename, attrs=None, 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 useimageioto read the file.- Parameters:
- filename
str The path of the texture file to read.
- attrs
dict,optional A dictionary of attributes to call on the reader. Keys of dictionary are the attribute/method names and values are the arguments passed to those calls. If you do not have any attributes to call, pass
Noneas the value.- progress_barbool, default:
False Optionally show a progress bar.
- filename
- Returns:
pyvista.TexturePyVista texture object.
Examples
Read in an example jpg map file as a texture.
>>> import os >>> import pyvista >>> from pyvista import examples >>> os.path.basename(examples.mapfile) '2k_earth_daymap.jpg' >>> texture = pyvista.read_texture(examples.mapfile) >>> type(texture) <class 'pyvista.plotting.texture.Texture'>