Quick update to the README file. For intros and books we now point to
[python/dscho.git] / Doc / lib / librgbimg.tex
blobe51e94a418545c35fe5657b35e86d903a7cb5afe
1 \section{\module{rgbimg} ---
2 Read and write ``SGI RGB'' files}
4 \declaremodule{builtin}{rgbimg}
5 \modulesynopsis{Read and write image files in ``SGI RGB'' format (the module is
6 \emph{not} SGI specific though!).}
9 The \module{rgbimg} module allows Python programs to access SGI imglib image
10 files (also known as \file{.rgb} files). The module is far from
11 complete, but is provided anyway since the functionality that there is
12 enough in some cases. Currently, colormap files are not supported.
14 The module defines the following variables and functions:
16 \begin{excdesc}{error}
17 This exception is raised on all errors, such as unsupported file type, etc.
18 \end{excdesc}
20 \begin{funcdesc}{sizeofimage}{file}
21 This function returns a tuple \code{(\var{x}, \var{y})} where
22 \var{x} and \var{y} are the size of the image in pixels.
23 Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels
24 are currently supported.
25 \end{funcdesc}
27 \begin{funcdesc}{longimagedata}{file}
28 This function reads and decodes the image on the specified file, and
29 returns it as a Python string. The string has 4 byte RGBA pixels.
30 The bottom left pixel is the first in
31 the string. This format is suitable to pass to \function{gl.lrectwrite()},
32 for instance.
33 \end{funcdesc}
35 \begin{funcdesc}{longstoimage}{data, x, y, z, file}
36 This function writes the RGBA data in \var{data} to image
37 file \var{file}. \var{x} and \var{y} give the size of the image.
38 \var{z} is 1 if the saved image should be 1 byte greyscale, 3 if the
39 saved image should be 3 byte RGB data, or 4 if the saved images should
40 be 4 byte RGBA data. The input data always contains 4 bytes per pixel.
41 These are the formats returned by \function{gl.lrectread()}.
42 \end{funcdesc}
44 \begin{funcdesc}{ttob}{flag}
45 This function sets a global flag which defines whether the scan lines
46 of the image are read or written from bottom to top (flag is zero,
47 compatible with SGI GL) or from top to bottom(flag is one,
48 compatible with X). The default is zero.
49 \end{funcdesc}