aboutsummaryrefslogtreecommitdiffstats
path: root/pnm.txi
blob: 2f7ae884841aa99525cec8f1f463fb52efe39370 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@code{(require 'pnm)}
@ftindex pnm


@defun pnm:type-dimensions path

The string @var{path} must name a @dfn{portable bitmap graphics} file.
@cindex portable bitmap graphics
@code{pnm:type-dimensions} returns a list of 4 items:
@enumerate
@item
A symbol describing the type of the file named by @var{path}.
@item
The image width in pixels.
@item
The image height in pixels.
@item
The maximum value of pixels assume in the file.
@end enumerate

The current set of file-type symbols is:
@table @asis
@item pbm
@itemx pbm-raw
@cindex pbm
@cindex pbm-raw
Black-and-White image; pixel values are 0 or 1.
@item pgm
@itemx pgm-raw
@cindex pgm
@cindex pgm-raw
Gray (monochrome) image; pixel values are from 0 to @var{maxval}
specified in file header.
@item ppm
@itemx ppm-raw
@cindex ppm
@cindex ppm-raw
RGB (full color) image; red, green, and blue interleaved pixel values
are from 0 to @var{maxval}
@end table
@end defun


@defun pnm:image-file->array path array


Reads the @dfn{portable bitmap graphics} file named by @var{path} into
@cindex portable bitmap graphics
@var{array}.  @var{array} must be the correct size and type for
@var{path}.  @var{array} is returned.


@defunx pnm:image-file->array path

@code{pnm:image-file->array} creates and returns an array with the
@dfn{portable bitmap graphics} file named by @var{path} read into it.
@cindex portable bitmap graphics
@end defun


@defun pnm:array-write type array maxval path comment @dots{}


Writes the contents of @var{array} to a @var{type} image file named @var{path}.  The file
will have pixel values between 0 and @var{maxval}, which must be compatible
with @var{type}.  For @samp{pbm} files, @var{maxval} must be @samp{1}.
@var{comment}s are included in the file header.
@end defun