| 1 | \section{\module{imageop} ---
|
|---|
| 2 | Manipulate raw image data}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{builtin}{imageop}
|
|---|
| 5 | \modulesynopsis{Manipulate raw image data.}
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 | The \module{imageop} module contains some useful operations on images.
|
|---|
| 9 | It operates on images consisting of 8 or 32 bit pixels stored in
|
|---|
| 10 | Python strings. This is the same format as used by
|
|---|
| 11 | \function{gl.lrectwrite()} and the \refmodule{imgfile} module.
|
|---|
| 12 |
|
|---|
| 13 | The module defines the following variables and functions:
|
|---|
| 14 |
|
|---|
| 15 | \begin{excdesc}{error}
|
|---|
| 16 | This exception is raised on all errors, such as unknown number of bits
|
|---|
| 17 | per pixel, etc.
|
|---|
| 18 | \end{excdesc}
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | \begin{funcdesc}{crop}{image, psize, width, height, x0, y0, x1, y1}
|
|---|
| 22 | Return the selected part of \var{image}, which should by
|
|---|
| 23 | \var{width} by \var{height} in size and consist of pixels of
|
|---|
| 24 | \var{psize} bytes. \var{x0}, \var{y0}, \var{x1} and \var{y1} are like
|
|---|
| 25 | the \function{gl.lrectread()} parameters, i.e.\ the boundary is
|
|---|
| 26 | included in the new image. The new boundaries need not be inside the
|
|---|
| 27 | picture. Pixels that fall outside the old image will have their value
|
|---|
| 28 | set to zero. If \var{x0} is bigger than \var{x1} the new image is
|
|---|
| 29 | mirrored. The same holds for the y coordinates.
|
|---|
| 30 | \end{funcdesc}
|
|---|
| 31 |
|
|---|
| 32 | \begin{funcdesc}{scale}{image, psize, width, height, newwidth, newheight}
|
|---|
| 33 | Return \var{image} scaled to size \var{newwidth} by \var{newheight}.
|
|---|
| 34 | No interpolation is done, scaling is done by simple-minded pixel
|
|---|
| 35 | duplication or removal. Therefore, computer-generated images or
|
|---|
| 36 | dithered images will not look nice after scaling.
|
|---|
|
|---|