1Pnm(3)                User Contributed Perl Documentation               Pnm(3)
2
3
4

NAME

6       PDL::IO::Pnm -- pnm format I/O for PDL
7

SYNOPSIS

9         use PDL::IO::Pnm;
10         $im = wpnm $pdl, $file, $format[, $raw];
11         rpnm $stack->slice(':,:,:,(0)'),"PDL.ppm";
12

DESCRIPTION

14       pnm I/O for PDL.
15

FUNCTIONS

17       rpnm
18
19       Read a pnm (portable bitmap/pixmap, pbm/ppm) file into a piddle.
20
21       Reads a file in pnm format (ascii or raw) into a pdl (magic numbers
22       P1-P6).  Based on the input format it returns pdls with arrays of size
23       (width,height) if binary or grey value data (pbm and pgm) or
24       (3,width,height) if rgb data (ppm). This also means for a palette image
25       that the distinction between an image and its lookup table is lost
26       which can be a problem in cases (but can hardly be avoided when using
27       netpbm/pbmplus).  Datatype is dependent on the maximum grey/color-com‐
28       ponent value (for raw and binary formats always PDL_B). rpnm tries to
29       read chopped files by zero padding the missing data (well it currently
30       doesn't, it barfs; I'll probably fix it when it becomes a problem for
31       me ;). You can also read directly into an existing pdl that has to have
32       the right size(!). This can come in handy when you want to read a
33       sequence of images into a datacube.
34
35       For details about the formats see appropriate manpages that come with
36       the netpbm/pbmplus packages.
37
38           $im = rpnm $file;
39
40         $stack = zeroes(byte,3,500,300,4);
41         rpnm $stack->slice(':,:,:,(0)'),"PDL.ppm";
42
43       reads an rgb image (that had better be of size (500,300)) into the
44       first plane of a 3D RGB datacube (=4D pdl datacube). You can also do
45       inplace transpose/inversion that way.
46
47       wpnm
48
49       Write a pnm (portable bitmap/pixmap, pbm/ppm) file into a file.
50
51       Writes data in a pdl into pnm format (ascii or raw) (magic numbers
52       P1-P6).  The $format is required (normally produced by wpic) and rou‐
53       tine just checks if data is compatible with that format. All conver‐
54       sions should already have been done. If possible, usage of wpic is pre‐
55       ferred. Currently RAW format is chosen if compliant with range of input
56       data. Explicit control of ASCII/RAW is possible through the optional
57       $raw argument. If RAW is set to zero it will enforce ASCII mode.
58       Enforcing RAW is somewhat meaningless as the routine will always try to
59       write RAW format if the data range allows (but maybe it should reduce
60       to a RAW supported type when RAW == 'RAW'?). For details about the for‐
61       mats consult appropriate manpages that come with the netpbm/pbmplus
62       packages.
63
64           $im = wpnm $pdl, $file, $format[, $raw];
65

BUGS

67       The stderr of the converters is redirected to a file. The filename is
68       currently generated in a probably non-portable way. A method that
69       avoids a file (and is portable) would be prefered.
70
71       "rpnm" currently relies on the fact that the header is separated from
72       the image data by a newline. This is not required by the p[bgp]m for‐
73       mats (in fact any whitespace is allowed) but most of the pnm writers
74       seem to comply with that. Truncated files are currently treated
75       ungracefully ("rpnm" just barfs).
76

AUTHOR

78       Copyright (C) 1996,1997 Christian Soeller <c.soeller@auckland.ac.nz>
79       All rights reserved. There is no warranty. You are allowed to redis‐
80       tribute this software / documentation under certain conditions. For
81       details, see the file COPYING in the PDL distribution. If this file is
82       separated from the PDL distribution, the copyright notice should be
83       included in the file.
84

FUNCTIONS

86       pnminraw
87
88         Signature: (type(); byte+ [o] im(m,n); int ms => m; int ns => n;
89                               int isbin; char* fd)
90
91       Read in a raw pnm file.
92
93       read a raw pnm file. The "type" argument is only there to determine the
94       type of the operation when creating "im" or trigger the appropriate
95       type conversion (maybe we want a byte+ here so that "im" follows
96       strictly the type of "type").
97
98       pnminascii
99
100         Signature: (type(); byte+ [o] im(m,n); int ms => m; int ns => n;
101                               int format; char* fd)
102
103       Read in an ascii pnm file.
104
105       pnmout
106
107         Signature: (a(m); int israw; int isbin; char *fd)
108
109       Write a line of pnm data.
110
111       This function is implemented this way so that threading works natu‐
112       rally.
113
114
115
116perl v5.8.8                       2006-12-02                            Pnm(3)
Impressum