read_texture#

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

Load a texture from an image file.

Parameters
filenamestr

The path of the texture file to read.

attrsdict, 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 None as the value.

progress_barbool, optional

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
>>> from pyvista import examples
>>> os.path.basename(examples.mapfile)
'2k_earth_daymap.jpg'
>>> texture = pyvista.read_texture(examples.mapfile)
>>> type(texture)
<class 'pyvista.core.objects.Texture'>