Channel defines the type and spatial layout of a channel. type is a PixelType. xSampling is the number of X-axis pixels between samples. ySampling is the number of Y-axis pixels between samples.
>>> import Imath
>>> print Imath.Channel(Imath.PixelType(Imath.PixelType.FLOAT), 4, 4)
FLOAT (4, 4)
Compression can have possible values: NO_COMPRESSION, RLE_COMPRESSION, ZIPS_COMPRESSION, ZIP_COMPRESSION, PIZ_COMPRESSION, PXR24_COMPRESSION.
>>> import Imath
>>> print Imath.Compression(Imath.Compression.RLE_COMPRESSION)
RLE_COMPRESSION
LineOrder can have three possible values: INCREASING_Y, DECREASING_Y, RANDOM_Y.
>>> import Imath
>>> print Imath.LineOrder(Imath.LineOrder.DECREASING_Y)
DECREASING_Y
PixelType can have possible values UINT, HALF, FLOAT.
>>> import Imath
>>> print Imath.PixelType(Imath.PixelType.HALF)
HALF
PreviewImage is a small preview image, intended as a thumbnail version of the full image. The image has size (width, height) and 8-bit pixel values are given by string pixels in RGBA order from top-left to bottom-right.
For example, to create a preview image from a JPEG file using the popular Python Imaging Library:
>>> import Image
>>> import Imath
>>> im = Image.open("lena.jpg").resize((100, 100)).convert("RGBA")
>>> print Imath.PreviewImage(im.size[0], im.size[1], im.tostring())
<Imath.PreviewImage instance 100x100>