collada.material.CImage

class collada.material.CImage(id, path, collada=None, xmlnode=None)

Class containing data coming from a <image> tag.

Basically is just the path to the file, but we give an extended functionality if PIL is available. You can in that case get the image object or numpy arrays in both int and float format. We named it CImage to avoid confusion with PIL’s Image class.

__init__(id, path, collada=None, xmlnode=None)

Create an image object.

Parameters:
  • id (str) – A unique string identifier for the image

  • path (str) – Path relative to the collada document where the image is located

  • collada (collada.Collada) – The collada object this image belongs to

  • xmlnode – If loaded from xml, the node this data comes from

Methods

__init__(id, path[, collada, xmlnode])

Create an image object.

getData()

getFloatArray()

getImage()

getUintArray()

load(collada, localspace, node)

Load and return a class instance from an XML node.

save()

Saves the image back to xmlnode.

setData(data)

Attributes

data

Raw binary image file data if the file is readable.

floatarray

Numpy float array (height, width, nchannels) with the image data normalized to 1.0.

pilimage

PIL Image object if PIL is available and the file is readable.

uintarray

Numpy array (height, width, nchannels) in integer format.

xmlnode

ElementTree representation of the image.

id

The unique string identifier for the image

path

Path relative to the collada document where the image is located