diff options
author | Georg Brandl <georg@python.org> | 2007-08-15 14:28:01 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-08-15 14:28:01 (GMT) |
commit | 8ec7f656134b1230ab23003a94ba3266d7064122 (patch) | |
tree | bc730d5fb3302dc375edd26b26f750d609b61d72 /Doc/library/imgfile.rst | |
parent | f56181ff53ba00b7bed3997a4dccd9a1b6217b57 (diff) | |
download | cpython-8ec7f656134b1230ab23003a94ba3266d7064122.zip cpython-8ec7f656134b1230ab23003a94ba3266d7064122.tar.gz cpython-8ec7f656134b1230ab23003a94ba3266d7064122.tar.bz2 |
Move the 2.6 reST doc tree in place.
Diffstat (limited to 'Doc/library/imgfile.rst')
-rw-r--r-- | Doc/library/imgfile.rst | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Doc/library/imgfile.rst b/Doc/library/imgfile.rst new file mode 100644 index 0000000..b0c67bf --- /dev/null +++ b/Doc/library/imgfile.rst @@ -0,0 +1,68 @@ + +:mod:`imgfile` --- Support for SGI imglib files +=============================================== + +.. module:: imgfile + :platform: IRIX + :synopsis: Support for SGI imglib files. + + +The :mod:`imgfile` module allows Python programs to access SGI imglib image +files (also known as :file:`.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: + + +.. exception:: error + + This exception is raised on all errors, such as unsupported file type, etc. + + +.. function:: getsizes(file) + + This function returns a tuple ``(x, y, z)`` where *x* and *y* are the size of + the image in pixels and *z* is the number of bytes per pixel. Only 3 byte RGB + pixels and 1 byte greyscale pixels are currently supported. + + +.. function:: read(file) + + This function reads and decodes the image on the specified file, and returns it + as a Python string. The string has either 1 byte greyscale pixels or 4 byte RGBA + pixels. The bottom left pixel is the first in the string. This format is + suitable to pass to :func:`gl.lrectwrite`, for instance. + + +.. function:: readscaled(file, x, y, filter[, blur]) + + This function is identical to read but it returns an image that is scaled to the + given *x* and *y* sizes. If the *filter* and *blur* parameters are omitted + scaling is done by simply dropping or duplicating pixels, so the result will be + less than perfect, especially for computer-generated images. + + Alternatively, you can specify a filter to use to smooth the image after + scaling. The filter forms supported are ``'impulse'``, ``'box'``, + ``'triangle'``, ``'quadratic'`` and ``'gaussian'``. If a filter is specified + *blur* is an optional parameter specifying the blurriness of the filter. It + defaults to ``1.0``. + + :func:`readscaled` makes no attempt to keep the aspect ratio correct, so that is + the users' responsibility. + + +.. function:: 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. + + +.. function:: write(file, data, x, y, z) + + This function writes the RGB or greyscale data in *data* to image file *file*. + *x* and *y* give the size of the image, *z* is 1 for 1 byte greyscale images or + 3 for RGB images (which are stored as 4 byte values of which only the lower + three bytes are used). These are the formats returned by :func:`gl.lrectread`. + |