Texture Data

Texture image data can also be created in memory, instead of reading from a file.

The data must be an array of bytes. In Python, it's a string object.

String data can be constructed from other data using the struct module.

def createTextureString(rgbList):
    s = ''
    for rgb in rgbList:
        s += struct.pack('BBB', rgb[0], rgb[1],
                         rgb[2])
    return s