GNU Info

Info Node: (python2.1-lib.info)rgbimg

(python2.1-lib.info)rgbimg


Next: imghdr Prev: colorsys Up: Multimedia Services
Enter node , (file) or (file)node

Read and write "SGI RGB" files
==============================

Read and write image files in "SGI RGB" format (the module is _not_ SGI
specific though!).

The `rgbimg' module allows Python programs to access SGI imglib image
files (also known as `.rgb' files).  The module is far from complete,
but is provided anyway since the functionality that there is enough in
some cases.  Currently, colormap files are not supported.

The module defines the following variables and functions:

`error'
     This exception is raised on all errors, such as unsupported file
     type, etc.

`sizeofimage(file)'
     This function returns a tuple `(X, Y)' where X and Y are the size
     of the image in pixels.  Only 4 byte RGBA pixels, 3 byte RGB
     pixels, and 1 byte greyscale pixels are currently supported.

`longimagedata(file)'
     This function reads and decodes the image on the specified file,
     and returns it as a Python string. The string has 4 byte RGBA
     pixels.  The bottom left pixel is the first in the string. This
     format is suitable to pass to `gl.lrectwrite()', for instance.

`longstoimage(data, x, y, z, file)'
     This function writes the RGBA data in DATA to image file FILE. X
     and Y give the size of the image.  Z is 1 if the saved image
     should be 1 byte greyscale, 3 if the saved image should be 3 byte
     RGB data, or 4 if the saved images should be 4 byte RGBA data.
     The input data always contains 4 bytes per pixel.  These are the
     formats returned by `gl.lrectread()'.

`ttob(flag)'
     This function sets a global flag which defines whether the scan
     lines of the image are read or written from bottom to top (flag is
     zero, compatible with SGI GL) or from top to bottom(flag is one,
     compatible with X).  The default is zero.


automatically generated by info2www version 1.2.2.9