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.

FUNCTIONS

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

BUGS

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

AUTHOR

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

FUNCTIONS

83   pnminraw
84         Signature: (type(); byte+ [o] im(m,n); int ms => m; int ns => n;
85                               int isbin; char* fd)
86
87       Read in a raw pnm file.
88
89       read a raw pnm file. The "type" argument is only there to determine the
90       type of the operation when creating "im" or trigger the appropriate
91       type conversion (maybe we want a byte+ here so that "im" follows
92       strictly the type of "type").
93
94       pnminraw does not process bad values.  It will set the bad-value flag
95       of all output piddles if the flag is set for any of the input piddles.
96
97   pnminascii
98         Signature: (type(); byte+ [o] im(m,n); int ms => m; int ns => n;
99                               int format; char* fd)
100
101       Read in an ascii pnm file.
102
103       pnminascii does not process bad values.  It will set the bad-value flag
104       of all output piddles if the flag is set for any of the input piddles.
105
106   pnmout
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
112       naturally.
113
114       pnmout does not process bad values.  It will set the bad-value flag of
115       all output piddles if the flag is set for any of the input piddles.
116
117
118
119perl v5.12.3                      2011-03-31                            Pnm(3)
Impressum