Vizard 7 » Command Index » Vizard objects » texture » <texture>.save
7.6

<texture>.save

Save the texture image to a file

<texture>.save(  
filename  
face = viz.POSITIVE_X  
)  
filename
Specifies the file name to save the texture image to.
face = viz.POSITIVE_X
This is an optional argument used only with Cube Mapped textures. It specifies which face of the cubemap to save. This can be one of the following values:

viz.POSITIVE_X
viz.NEGATIVE_X
viz.POSITIVE_Y
viz.NEGATIVE_Y
viz.POSITIVE_Z
viz.NEGATIVE_Z

Remarks

This command will save the image associated with the texture to the specified filename. The extension of the specified filename is used to determine which format to save the image to.

If the texture does not contain image data (e.g. render textures, textures with freed memory, etc..), then the image data will be read from the texture object on the GPU.

Return Value

True/False

Example

# Load a PNG image
tex = viz.addTexture('image.png')

# Save it to JPEG format
tex.save('image.jpg')

See also

<texture>.saveToBuffer