blob: ab20fd6216e2185be59d87f9950e51620f37edb2 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{rgbimg} ---
Fred Drake67d229e1999-02-20 04:51:16 +00002 Read and write ``SGI RGB'' files}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drake67d229e1999-02-20 04:51:16 +00004\declaremodule{builtin}{rgbimg}
Fred Drake97e32012001-12-04 16:49:00 +00005\modulesynopsis{Read and write image files in ``SGI RGB'' format (the module
6 is \emph{not} SGI specific though!).}
Fred Drakeb91e9341998-07-23 17:59:49 +00007
Georg Brandlb56230b2006-02-17 11:18:58 +00008\deprecated{2.5}{This module is not maintained anymore and seems to be
9 unused.}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000010
Fred Drake7932a6b1998-04-03 07:09:38 +000011The \module{rgbimg} module allows Python programs to access SGI imglib image
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000012files (also known as \file{.rgb} files). The module is far from
13complete, but is provided anyway since the functionality that there is
Fred Drakefc576191998-04-04 07:15:02 +000014enough in some cases. Currently, colormap files are not supported.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000015
Fred Drake97e32012001-12-04 16:49:00 +000016\note{This module is only built by default for 32-bit platforms; it is
17not expected to work properly on other systems.}
18
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000019The module defines the following variables and functions:
20
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000021\begin{excdesc}{error}
22This exception is raised on all errors, such as unsupported file type, etc.
23\end{excdesc}
24
25\begin{funcdesc}{sizeofimage}{file}
26This function returns a tuple \code{(\var{x}, \var{y})} where
27\var{x} and \var{y} are the size of the image in pixels.
28Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels
29are currently supported.
30\end{funcdesc}
31
32\begin{funcdesc}{longimagedata}{file}
33This function reads and decodes the image on the specified file, and
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000034returns it as a Python string. The string has 4 byte RGBA pixels.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000035The bottom left pixel is the first in
Fred Drakefc576191998-04-04 07:15:02 +000036the string. This format is suitable to pass to \function{gl.lrectwrite()},
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000037for instance.
38\end{funcdesc}
39
Fred Drakecce10901998-03-17 06:33:25 +000040\begin{funcdesc}{longstoimage}{data, x, y, z, file}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000041This function writes the RGBA data in \var{data} to image
42file \var{file}. \var{x} and \var{y} give the size of the image.
43\var{z} is 1 if the saved image should be 1 byte greyscale, 3 if the
44saved image should be 3 byte RGB data, or 4 if the saved images should
45be 4 byte RGBA data. The input data always contains 4 bytes per pixel.
Fred Drakefc576191998-04-04 07:15:02 +000046These are the formats returned by \function{gl.lrectread()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000047\end{funcdesc}
48
49\begin{funcdesc}{ttob}{flag}
50This function sets a global flag which defines whether the scan lines
51of the image are read or written from bottom to top (flag is zero,
Georg Brandlb56230b2006-02-17 11:18:58 +000052compatible with SGI GL) or from top to bottom (flag is one,
Fred Drake52088231998-11-30 16:27:37 +000053compatible with X). The default is zero.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000054\end{funcdesc}