@@ -2,51 +2,56 @@ \section{Built-in Module \sectcode{jpeg}}
22\label {module-jpeg }
33\bimodindex {jpeg}
44
5- The module \code {jpeg} provides access to the jpeg compressor and
6- decompressor written by the Independent JPEG Group. JPEG is a (draft?)\
5+ The module \module {jpeg} provides access to the jpeg compressor and
6+ decompressor written by the Independent JPEG Group. JPEG is a (draft?)
77standard for compressing pictures. For details on jpeg or the
88Independent JPEG Group software refer to the JPEG standard or the
99documentation provided with the software.
1010
11- The \code {jpeg} module defines these functions:
12-
13- \setindexsubitem {(in module jpeg)}
14- \begin {funcdesc }{compress}{data\, w\, h\, b}
15- Treat data as a pixmap of width \var {w} and height \var {h}, with \var {b} bytes per
16- pixel. The data is in SGI GL order, so the first pixel is in the
17- lower-left corner. This means that \code {lrectread} return data can
18- immediately be passed to compress. Currently only 1 byte and 4 byte
19- pixels are allowed, the former being treated as greyscale and the
20- latter as RGB color. Compress returns a string that contains the
21- compressed picture, in JFIF format.
11+ The \module {jpeg} module defines an exception and some functions.
12+
13+ \begin {excdesc }{error}
14+ Exception raised by \function {compress()} and \function {decompress()}
15+ in case of errors.
16+ \end {excdesc }
17+
18+ \begin {funcdesc }{compress}{data, w, h, b}
19+ Treat data as a pixmap of width \var {w} and height \var {h}, with
20+ \var {b} bytes per pixel. The data is in SGI GL order, so the first
21+ pixel is in the lower-left corner. This means that \code {gl.lrectread}
22+ return data can immediately be passed to \function {compress()}.
23+ Currently only 1 byte and 4 byte pixels are allowed, the former being
24+ treated as greyscale and the latter as RGB color.
25+ \function {compress()} returns a string that contains the compressed
26+ picture, in JFIF format.
2227\end {funcdesc }
2328
2429\begin {funcdesc }{decompress}{data}
2530Data is a string containing a picture in JFIF format. It returns a
26- tuple
27- \code {( \ var {data}, \var {width}, \var {height}, \var { bytesperpixel})}.
28- Again, the data is suitable to pass to \code {lrectwrite}.
31+ tuple \code {( \var {data}, \var {width}, \var {height},
32+ \var {bytesperpixel})}. Again, the data is suitable to pass to
33+ \code {gl. lrectwrite}.
2934\end {funcdesc }
3035
31- \begin {funcdesc }{setoption}{name\, value}
32- Set various options. Subsequent compress and decompress calls
33- will use these options. The following options are available:
34- \begin {description }
35- \item [\code {'forcegray' }]
36- Force output to be grayscale, even if input is RGB.
37-
38- \item [\code {'quality' }]
39- Set the quality of the compressed image to a
40- value between \code {0} and \code {100} (default is \code {75}). Compress only.
41-
42- \item [\code {'optimize' }]
43- Perform Huffman table optimization. Takes longer, but results in
44- smaller compressed image. Compress only.
45-
46- \item [\code {'smooth' }]
47- Perform inter-block smoothing on uncompressed image. Only useful for
48- low-quality images. Decompress only.
49- \end {description }
36+ \begin {funcdesc }{setoption}{name, value}
37+ Set various options. Subsequent \function {compress()} and
38+ \function {decompress()} calls will use these options. The following
39+ options are available:
40+
41+ \begin {tableii }{|l|l|}{code}{Option}{Effect}
42+ \lineii {'forcegray'}{%
43+ Force output to be grayscale, even if input is RGB.}
44+ \lineii {'quality'}{%
45+ Set the quality of the compressed image to a value between
46+ \code {0} and \code {100} (default is \code {75}). \\
47+ &This only affects compression.}
48+ \lineii {'optimize'}{%
49+ Perform Huffman table optimization. Takes longer, but results in
50+ smaller compressed \\
51+ &image. This only affects compression.}
52+ \lineii {'smooth'}{%
53+ Perform inter-block smoothing on uncompressed image. Only useful
54+ for low-quality \\
55+ &images. This only affects decompression.}
56+ \end {tableii }
5057\end {funcdesc }
51-
52- Compress and uncompress raise the error \code {jpeg.error} in case of errors.
0 commit comments