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 -maxval N
60 N is the maxval for the gray values in the input, and is also
61 the maxval of the PGM output image. The default is the maximum
62 value that can be represented in the number of bytes used for
63 each sample (i.e. 255 or 65535).
64
65
66 -bpp [1|2]
67 tells the number of bytes that represent each sample in the
68 input. If the value is 2, The most significant byte is first in
69 the stream.
70
71 The default is 1 byte per sample.
72
73
74 -littleendian
75 says that the bytes of each input sample are ordered with the
76 least significant byte first. Without this option, rawtopgm
77 assumes MSB first. This obviously has no effect when there is
78 only one byte per sample.
79
80
81 -headerskip N
82 rawtopgm skips over N bytes at the beginning of the stream and
83 reads the image immediately after. The default is 0.
84
85 This is useful when the input is actually some graphics format
86 that has a descriptive header followed by an ordinary raster,
87 and you don't have a program that understands the header or you
88 want to ignore the header.
89
90
91 -rowskip N
92 If there is padding at the ends of the rows, you can skip it
93 with this option. Note that rowskip need not be an integer.
94 Amazingly, I once had an image with 0.376 bytes of padding per
95 row. This turned out to be due to a file-transfer problem, but
96 I was still able to read the image.
97
98 Skipping a fractional byte per row means skipping one byte per
99 multiple rows.
100
101
102 -bt -bottomfirst
103 By default, rawtopgm assumes the pixels in the input go top to
104 bottom, left to right. If you specify -bt or -bottomfirst, raw‐
105 topgm assumes the pixels go bottom to top, left to right. The
106 Molecular Dynamics and Leica confocal format, for example, use
107 the latter arrangement.
108
109 If you don't specify -bt when you should or vice versa, the
110 resulting image is upside down, which you can correct with pam‐
111 flip.
112
113 This option causes rawtopgm to read the entire input stream into
114 storage at once, which may take a lot of storage. Ordinarly,
115 rawtopgm stores only one row at a time.
116
117 For backwards compatibility, rawtopgm also accepts -tb
118 and -topbottom to mean exactly the same thing. The reasons
119 these are named backwards is that the original author thought of
120 it as specifying that the wrong results of assuming the data is
121 top to bottom should be corrected by flipping the result top for
122 bottom. Today, we think of it as simply specifying the format
123 of the input data so that there are no wrong results.
124
125
126
127
129 pgm(1), rawtoppm(1), pamflip(1)
130
131
133 Copyright (C) 1989 by Jef Poskanzer. Modified June 1993 by Oliver
134 Trepte, oliver@fysik4.kth.se
135
136
137
138netpbm documentation 14 September 2000 Rawtopgm User Manual(0)