1Rawtopgm User Manual(0) Rawtopgm User Manual(0)
2
3
4
6 rawtopgm - convert raw grayscale bytes to a PGM image
7
8
10 rawtopgm
11
12 [-bpp [1|2]]
13
14 [-littleendian]
15
16 [-maxval N]
17
18 [-headerskip N]
19
20 [-rowskip N]
21
22 [-tb|-topbottom]
23
24 [width height]
25
26 [imagefile]
27
28
30 This program is part of Netpbm(1).
31
32 rawtopgm reads raw grayscale values as input and produces a PGM image
33 as output. The input file is just a sequence of pure binary numbers,
34 either one or two bytes each, either bigendian or littleendian, repre‐
35 senting gray values. They may be arranged either top to bottom, left
36 to right or bottom to top, left to right. There may be arbitrary
37 header information at the start of the file (to which rawtopgm pays no
38 attention at all other than the header's size).
39
40 Arguments to rawtopgm tell how to interpret the pixels (a function that
41 is served by a header in a regular graphics format).
42
43 The width and height parameters tell the dimensions of the image. If
44 you omit these parameters, rawtopgm assumes it is a quadratic image and
45 bases the dimensions on the size of the input stream. If this size is
46 not a perfect square, rawtopgm fails.
47
48 When you don't specify width and height, rawtopgm reads the entire
49 input stream into storage at once, which may take a lot of storage.
50 Otherwise, rawtopgm ordinarily stores only one row at a time.
51
52 If you don't specify imagefile, or specify -, the input is from Stan‐
53 dard Input.
54
55 The PGM output is to Standard Output.
56
57
59 In addition to the options common to all programs based on libnetpbm
60 (most notably -quiet, see
61 Common Options ⟨index.html#commonoptions⟩ ), rawtopgm recognizes the
62 following command line options:
63
64
65
66 -maxval N
67 N is the maxval for the gray values in the input, and is also
68 the maxval of the PGM output image. The default is the maximum
69 value that can be represented in the number of bytes used for
70 each sample (i.e. 255 or 65535).
71
72
73 -bpp [1|2]
74 tells the number of bytes that represent each sample in the
75 input. If the value is 2, The most significant byte is first in
76 the stream.
77
78 The default is 1 byte per sample.
79
80
81 -littleendian
82 says that the bytes of each input sample are ordered with the
83 least significant byte first. Without this option, rawtopgm
84 assumes MSB first. This obviously has no effect when there is
85 only one byte per sample.
86
87
88 -headerskip N
89 rawtopgm skips over N bytes at the beginning of the stream and
90 reads the image immediately after. The default is 0.
91
92 This is useful when the input is actually some graphics format
93 that has a descriptive header followed by an ordinary raster,
94 and you don't have a program that understands the header or you
95 want to ignore the header.
96
97
98 -rowskip N
99 If there is padding at the ends of the rows, you can skip it
100 with this option. Note that rowskip need not be an integer.
101 Amazingly, I once had an image with 0.376 bytes of padding per
102 row. This turned out to be due to a file-transfer problem, but
103 I was still able to read the image.
104
105 Skipping a fractional byte per row means skipping one byte per
106 multiple rows.
107
108
109 -bt -bottomfirst
110 By default, rawtopgm assumes the pixels in the input go top to
111 bottom, left to right. If you specify -bt or -bottomfirst, raw‐
112 topgm assumes the pixels go bottom to top, left to right. The
113 Molecular Dynamics and Leica confocal format, for example, use
114 the latter arrangement.
115
116 If you don't specify -bt when you should or vice versa, the
117 resulting image is upside down, which you can correct with pam‐
118 flip.
119
120 This option causes rawtopgm to read the entire input stream into
121 storage at once, which may take a lot of storage. Normally,
122 rawtopgm stores only one row at a time.
123
124 For backwards compatibility, rawtopgm also accepts -tb
125 and -topbottom to mean exactly the same thing. The reasons
126 these are named backwards is that the original author thought of
127 it as specifying that the wrong results of assuming the data is
128 top to bottom should be corrected by flipping the result top for
129 bottom. Today, we think of it as simply specifying the format
130 of the input data so that there are no wrong results.
131
132
133
134
136 pgm(1), rawtoppm(1), pamflip(1)
137
138
140 Copyright (C) 1989 by Jef Poskanzer. Modified June 1993 by Oliver
141 Trepte, oliver@fysik4.kth.se
142
144 This manual page was generated by the Netpbm tool 'makeman' from HTML
145 source. The master documentation is at
146
147 http://netpbm.sourceforge.net/doc/rawtopgm.html
148
149netpbm documentation 14 September 2000 Rawtopgm User Manual(0)