Texture

class ImageDynamic
BYTE = 1

Unsigned byte image, 8 bits/channel, \([0, 255]\) range.

SHORT = 2

Unsigned short, 16 bits/channel, \([0, 65535]\) range.

FLOAT = 4

Float, 32 bits/channel, \([0.0, 1.0]\) range.

ImageFormat

class ImageFormat
GREY = 1

Greyscale image.

GREY_ALPHA = 2

Greyscale image with alpha.

RGB = 3

Color image.

RGBA = 4

Color image with alpha.

BGR = 5

Color image (red and blue channels swapped).

BGRA = 6

Color image (red and blue channels swapped) with alpha.

Texture

class Texture
property id

The id of the texture.

Type

str, read-only

property name

The name of the texture.

Type

str

Raises

ReadOnlyError -- If Database is in read only mode.

property group

The group of the texture.

Type

TextureGroup

Raises

ReadOnlyError -- If Database is in read only mode.

property width

The texture width in pixels.

Type

int, read-only

property height

The texture height in pixels.

Type

int, read-only

property dpi_x

The texture DPI (dots/inch) in X direction.

Type

float

Raises

ReadOnlyError -- If Database is in read only mode.

property dpi_y

The texture DPI (dots/inch) in Y direction.

Type

float

Raises

ReadOnlyError -- If Database is in read only mode.

property format

The format of the image.

Type

ImageFormat, read-only

property dynamic

The pixel type of the image.

Type

ImageDynamic, read-only

encoded_data(format, compression = -1)

Get the encoded data of the texture.

Parameters
  • format (str) -- The file format to encode the image to (jpeg, png, tiff, exr, bmp, targa, webp, xpm, hdr).

  • compression (int) -- The compression value to use while encoding. The value to use depend on the format (e.g. 0 to 100 for JPEG, 0 to 9 for PNG). -1 means default compression value.

Returns

The encoded data.

Return type

bytes

remove(force = False)

Delete this texture

Note

By default, only not used textures can be deleted (InUseError is raised otherwise), use force to force deletion of used textures.

Parameters

force (bool) -- Force the deletion of the texture even if it is in use.

Raises