rest25/library/imageop.rst => rest262/library/imageop.rst
f1
2:mod:`imageop` --- Manipulate raw image data
3============================================
4
5.. module:: imageop
6   :synopsis: Manipulate raw image data.
n7+   :deprecated:
7
n9+.. deprecated:: 2.6
10+    The :mod:`imageop` module has been removed in Python 3.0.
8
9The :mod:`imageop` module contains some useful operations on images. It operates
10on images consisting of 8 or 32 bit pixels stored in Python strings.  This is
11the same format as used by :func:`gl.lrectwrite` and the :mod:`imgfile` module.
12
13The module defines the following variables and functions:
14
15
16.. exception:: error
17
18   This exception is raised on all errors, such as unknown number of bits per
19   pixel, etc.
20
21
22.. function:: crop(image, psize, width, height, x0, y0, x1, y1)
23
n24-   Return the selected part of *image*, which should by *width* by *height* in size
n27+   Return the selected part of *image*, which should be *width* by *height* in size
25   and consist of pixels of *psize* bytes. *x0*, *y0*, *x1* and *y1* are like the
26   :func:`gl.lrectread` parameters, i.e. the boundary is included in the new image.
27   The new boundaries need not be inside the picture.  Pixels that fall outside the
28   old image will have their value set to zero.  If *x0* is bigger than *x1* the
29   new image is mirrored.  The same holds for the y coordinates.
30
31
32.. function:: scale(image, psize, width, height, newwidth, newheight)
48
49   Convert a 8-bit deep greyscale image to a 1-bit deep image by thresholding all
50   the pixels.  The resulting image is tightly packed and is probably only useful
51   as an argument to :func:`mono2grey`.
52
53
54.. function:: dither2mono(image, width, height)
55
n56-   Convert an 8-bit greyscale image to a 1-bit monochrome image using a (simple-
n59+   Convert an 8-bit greyscale image to a 1-bit monochrome image using a
57-   minded) dithering algorithm.
60+   (simple-minded) dithering algorithm.
58
59
60.. function:: mono2grey(image, width, height, p0, p1)
61
62   Convert a 1-bit monochrome image to an 8 bit greyscale or color image. All
63   pixels that are zero-valued on input get value *p0* on output and all one-value
64   input pixels get value *p1* on output.  To convert a monochrome black-and-white
65   image to greyscale pass the values ``0`` and ``255`` respectively.
88
89.. function:: grey22grey(image, width, height)
90
91   Convert a 2-bit greyscale image to an 8-bit greyscale image.
92
93
94.. data:: backward_compatible
95
t96-   If set to 0, the functions in this module use a non-backward compatible way of
t99+   If set to 0, the functions in this module use a non-backward compatible way
97-   representing multi-byte pixels on little-endian systems.  The SGI for which this
100+   of representing multi-byte pixels on little-endian systems.  The SGI for
98-   module was originally written is a big-endian system, so setting this variable
101+   which this module was originally written is a big-endian system, so setting
99-   will have no effect. However, the code wasn't originally intended to run on
102+   this variable will have no effect. However, the code wasn't originally
100-   anything else, so it made assumptions about byte order which are not universal.
103+   intended to run on anything else, so it made assumptions about byte order
101-   Setting this variable to 0 will cause the byte order to be reversed on little-
104+   which are not universal.  Setting this variable to 0 will cause the byte
102-   endian systems, so that it then is the same as on big-endian systems.
105+   order to be reversed on little-endian systems, so that it then is the same as
106+   on big-endian systems.
103
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op