Bases: pyffi.object_models.xml.FileFormat
This class implements the TGA format.
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 8-bit integer, describing the color map type.
Bases: pyffi.object_models.xml.basic.BasicBase
The Targa footer signature.
Return a hash value for the signature.
Returns: | An immutable object that can be used as a hash. |
---|
Return number of bytes that the signature occupies in a file.
Returns: | Number of bytes. |
---|
Get signature.
Returns: | The signature. |
---|
Read signature from stream.
Parameters: | stream (file) – The stream to read from. |
---|
Set signature.
Parameters: | value (str) – The value to assign. |
---|
Write signature to stream.
Parameters: | stream (file) – The stream to read from. |
---|
Bases: pyffi.object_models.xml.enum.EnumBase
An unsigned 8-bit integer, describing the image type.
alias of UndecodedData
alias of Byte
alias of Char
alias of Float
alias of Int
alias of Short
alias of UByte
alias of UInt
alias of UShort
>>> # check and read tga file
>>> stream = open('tests/tga/test.tga', 'rb')
>>> data = TgaFormat.Data()
>>> data.inspect(stream)
>>> data.read(stream)
>>> stream.close()
>>> data.header.width
60
>>> data.header.height
20
>>> for stream, data in TgaFormat.walkData('tests/tga'):
... data.read(stream)
... print(stream.name)
tests/tga/test.tga
tests/tga/test_footer.tga
>>> data = TgaFormat.Data()
>>> from tempfile import TemporaryFile
>>> stream = TemporaryFile()
>>> data.write(stream)
>>> stream.close()