| 1 | \section{\module{rgbimg} ---
|
|---|
| 2 | Read and write ``SGI RGB'' files}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{builtin}{rgbimg}
|
|---|
| 5 | \modulesynopsis{Read and write image files in ``SGI RGB'' format (the module
|
|---|
| 6 | is \emph{not} SGI specific though!).}
|
|---|
| 7 |
|
|---|
| 8 | \deprecated{2.5}{This module is not maintained anymore and seems to be
|
|---|
| 9 | unused.}
|
|---|
| 10 |
|
|---|
| 11 | The \module{rgbimg} module allows Python programs to access SGI imglib image
|
|---|
| 12 | files (also known as \file{.rgb} files). The module is far from
|
|---|
| 13 | complete, but is provided anyway since the functionality that there is
|
|---|
| 14 | enough in some cases. Currently, colormap files are not supported.
|
|---|
| 15 |
|
|---|
| 16 | \note{This module is only built by default for 32-bit platforms; it is
|
|---|
| 17 | not expected to work properly on other systems.}
|
|---|
| 18 |
|
|---|
| 19 | The module defines the following variables and functions:
|
|---|
| 20 |
|
|---|
| 21 | \begin{excdesc}{error}
|
|---|
| 22 | This exception is raised on all errors, such as unsupported file type, etc.
|
|---|
| 23 | \end{excdesc}
|
|---|
| 24 |
|
|---|
| 25 | \begin{funcdesc}{sizeofimage}{file}
|
|---|
| 26 | This function returns a tuple \code{(\var{x}, \var{y})} where
|
|---|
| 27 | \var{x} and \var{y} are the size of the image in pixels.
|
|---|
| 28 | Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels
|
|---|
| 29 | are currently supported.
|
|---|
| 30 | \end{funcdesc}
|
|---|
| 31 |
|
|---|
| 32 | \begin{funcdesc}{longimagedata}{file}
|
|---|
| 33 | This function reads and decodes the image on the specified file, and
|
|---|
| 34 | returns it as a Python string. The string has 4 byte RGBA pixels.
|
|---|
| 35 | The bottom left pixel is the first in
|
|---|
| 36 | the string. This format is suitable to pass to \function{gl.lrectwrite()},
|
|---|
| 37 | for instance.
|
|---|
| 38 | \end{funcdesc}
|
|---|
| 39 |
|
|---|
| 40 | \begin{funcdesc}{longstoimage}{data, x, y, z, file}
|
|---|
| 41 | This function writes the RGBA data in \var{data} to image
|
|---|
| 42 | file \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
|
|---|
| 44 | saved image should be 3 byte RGB data, or 4 if the saved images should
|
|---|
| 45 | be 4 byte RGBA data. The input data always contains 4 bytes per pixel.
|
|---|
| 46 | These are the formats returned by \function{gl.lrectread()}.
|
|---|
| 47 | \end{funcdesc}
|
|---|
| 48 |
|
|---|
| 49 | \begin{funcdesc}{ttob}{flag}
|
|---|
| 50 | This function sets a global flag which defines whether the scan lines
|
|---|
| 51 | of the image are read or written from bottom to top (flag is zero,
|
|---|
| 52 | compatible with SGI GL) or from top to bottom (flag is one,
|
|---|
| 53 | compatible with X). The default is zero.
|
|---|
| 54 | \end{funcdesc}
|
|---|