source: trunk/essentials/dev-lang/python/Doc/lib/libimageop.tex@ 3368

Last change on this file since 3368 was 3225, checked in by bird, 19 years ago

Python 2.5

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