Open topic with navigation
Save the texture image to a data buffer
|face = viz.POSITIVE_X
|dataType = viz.GL_UNSIGNED_BYTE
The extension of the filename will determine which image format to encode the data in (bmp, png, jpg, etc..)
Can also use '<raw>' to get the raw image data.
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:
dataType = viz.GL_UNSIGNED_BYTE
Specifies the data type to use when reading the image from the GPU. If the texture object already contains image data, then this parameter will be ignored. Can be one of the following values:
This command will save the image associated with the texture to a buffer in memory. 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.
Buffer data as a Python bytes object, or None if texture does not contain image data.
# Load a PNG image
tex = viz.addTexture('image.png')
# Save to a JPEG buffer
buf = tex.saveToBuffer('.jpg')