ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH

Reference
ActivePython 2.5
Python Documentation
Library Reference
19. Multimedia Services
19.1 audioop -- Manipulate raw audio data
19.2 imageop -- Manipulate raw image data
19.3 aifc -- Read and write AIFF and AIFC files
19.4 sunau -- Read and write Sun AU files
19.5 wave -- Read and write WAV files
19.6 chunk -- Read IFF chunked data
19.7 colorsys -- Conversions between color systems
19.8 rgbimg -- Read and write ``SGI RGB'' files
19.9 imghdr -- Determine the type of an image
19.10 sndhdr -- Determine type of sound file
19.11 ossaudiodev -- Access to OSS-compatible audio devices

MyASPN >> Reference >> ActivePython 2.5 >> Python Documentation >> Library Reference >> 19. Multimedia Services
ActivePython 2.5 documentation

19.8 rgbimg -- Read and write ``SGI RGB'' files

Deprecated since release 2.5. This module is not maintained anymore and seems to be unused.

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.

Note: This module is only built by default for 32-bit platforms; it is not expected to work properly on other systems.

The module defines the following variables and functions:

exception 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.
See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved