cpython-withatomic / Doc / librgbimg.tex

The branch 'legacy-trunk' does not exist.
\section{Built-in module \sectcode{rgbimg}}

The rgbimg 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
is enough in some cases.  Currently, colormap files are not supported.

The module defines the following variables and functions:

\renewcommand{\indexsubitem}{(in module rgbimg)}
This exception is raised on all errors, such as unsupported file type, etc.

This function returns a tuple \code{(\var{x}, \var{y})} where
\var{x} and \var{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.

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 \code{gl.lrectwrite},
for instance.

\begin{funcdesc}{longstoimage}{data\, x\, y\, z\, file}
This function writes the RGBA data in \var{data} to image
file \var{file}. \var{x} and \var{y} give the size of the image.
\var{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 \code{gl.lrectread}.

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.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.