1 \section{Built-in Module
\sectcode{rgbimg
}}
4 The rgbimg module allows python programs to access SGI imglib image
5 files (also known as
\file{.rgb
} files). The module is far from
6 complete, but is provided anyway since the functionality that there is
7 is enough in some cases. Currently, colormap files are not supported.
9 The module defines the following variables and functions:
11 \renewcommand{\indexsubitem}{(in module rgbimg)
}
12 \begin{excdesc
}{error
}
13 This exception is raised on all errors, such as unsupported file type, etc.
16 \begin{funcdesc
}{sizeofimage
}{file
}
17 This function returns a tuple
\code{(
\var{x
},
\var{y
})
} where
18 \var{x
} and
\var{y
} are the size of the image in pixels.
19 Only
4 byte RGBA pixels,
3 byte RGB pixels, and
1 byte greyscale pixels
20 are currently supported.
23 \begin{funcdesc
}{longimagedata
}{file
}
24 This function reads and decodes the image on the specified file, and
25 returns it as a Python string. The string has
4 byte RGBA pixels.
26 The bottom left pixel is the first in
27 the string. This format is suitable to pass to
\code{gl.lrectwrite
},
31 \begin{funcdesc
}{longstoimage
}{data\, x\, y\, z\, file
}
32 This function writes the RGBA data in
\var{data
} to image
33 file
\var{file
}.
\var{x
} and
\var{y
} give the size of the image.
34 \var{z
} is
1 if the saved image should be
1 byte greyscale,
3 if the
35 saved image should be
3 byte RGB data, or
4 if the saved images should
36 be
4 byte RGBA data. The input data always contains
4 bytes per pixel.
37 These are the formats returned by
\code{gl.lrectread
}.
40 \begin{funcdesc
}{ttob
}{flag
}
41 This function sets a global flag which defines whether the scan lines
42 of the image are read or written from bottom to top (flag is zero,
43 compatible with SGI GL) or from top to bottom(flag is one,
44 compatible with X)\@. The default is zero.