1Pamfix User Manual(0) Pamfix User Manual(0)
2
3
4
6 pamfix - repair a Netpbm image with various corruptions
7
8
10 pamfix
11
12 [-truncate] [-changemaxval] [-clip] [-verbose]
13
14 [netpbmfile]
15
16 Minimum unique abbreviation of option is acceptable. You may use dou‐
17 ble hyphens instead of single hyphen to denote options. You may use
18 white space in place of the equals sign to separate an option name from
19 its value.
20
21
22
24 This program is part of Netpbm(1).
25
26 pamfix reads a stream that is mostly a Netpbm image but may have cer‐
27 tain types of corruptions and produces a valid Netpbm image that pre‐
28 serves much of the information in the original.
29
30 In particular, Netpbm salvages streams that are truncated and that con‐
31 tain illegally large sample values.
32
33 pamfix looks at only on the first image in a multi-image stream.
34
35
36
37 Truncated Stream
38 This is a stream that is missing the last part. Netpbm corrects this
39 by creating an output image that simply has fewer rows.
40
41 You select this kind of repair with a -truncate option.
42
43 The header of a Netpbm image implies how large the image must be (how
44 many bytes the file must contain). If the file is actually smaller
45 than that, a Netpbm program that tries to read the image fails, with an
46 error message telling you that it couldn't read the whole file. The
47 data in the file is arranged in row order, from top to bottom, and the
48 most common reason for the file being smaller than its header says it
49 should be is because the bottommost rows are simply missing. So pamfix
50 assumes that is the case and generates a new image with just the rows
51 that are readable. (technically, that means the output's header indi‐
52 cates a smaller number of rows and omits any partial last row).
53
54 The most common way for a Netpbm file to be small is that something
55 interrupted the program that generated it before it was finished writ‐
56 ing the file. For example, the program ran out of its own input or
57 encountered a bug or ran out of space in which to write the output.
58
59 Another problem pamfix deals with is where the file isn't actually too
60 small, but because of a system error, a byte in the middle of it cannot
61 be read (think of a disk storage failure). pamfix reads the input
62 sequentially until it can't read any further, for any reason. So it
63 treats such an image as a truncated one, ignoring all data after the
64 unreadable byte.
65
66 But be aware that an image file is sometimes too small because of a bug
67 in the program that generated it, and in that case it is not simply a
68 matter of the bottom of the image missing, so pamfix simply creates a
69 valid Netpbm image containing a garbage picture.
70
71 If you want to test an image file to see if it is corrupted by being
72 too small, use pamfile --allimages . It fails with an error message if
73 the file is too small.
74
75 If you want to cut the bottom off a valid Netpbm image, use pamcut.
76
77
78
79 Excessive Sample Value
80 This is a stream that contains a purported sample value that is higher
81 than the maxval of the image.
82
83 The header of a Netpbm image tells the maxval of the image, which is a
84 value that gives meaning to all the sample values in the raster. The
85 sample values represent a fraction of the maxval, so a sample value
86 that is greater than the maxval makes no sense.
87
88 A regular Netpbm program fails if you give it input that contains a
89 value larger than the maxval where a sample value belongs.
90
91 pamfix has three ways of salvaging such a stream:
92
93
94
95 · Clip to the maxval. Request this with -clip.
96
97 · Raise the maxval, thus lowering the fraction represented by
98 every sample in the image. Request this with -changemaxval.
99
100 · Truncate the image at the first invalid sample value. Request
101 this with -truncate and neither -clip nor -changemaxval.
102
103
104 You cannot specify both -clip and -changemaxval.
105
106
107
109 In addition to the options common to all programs based on libnetpbm
110 (most notably -quiet, see
111 Common Options ⟨index.html#commonoptions⟩ ), pamfix recognizes the
112 following command line options:
113
114
115
116 -truncate
117 Create a truncated output image from all the valid input rows
118 that could be read.
119
120
121 -changemaxval
122 Raise the maxval to cope with pixel values that exceed the max‐
123 val stated in the header of the input file.
124
125
126 -clip Change all pixel values that exceed the maxval stated in the
127 header of the input file.
128
129
130 -verbose
131 Report details of the transportation to standard error.
132
133
134
135
137 pnm(1), pam(1), pamcut(1), pamfile(1), pamvalidate(1)
138
139
141 pamfix was new in Netpbm 10.66 (March 2014). But it grew out of pam‐
142 fixtrunc, which was new in Netpbm 10.38 (March 2007) and did only the
143 truncated image repair (and for invalid sample values would simply pass
144 them through to its output, generating an invalid Netpbm image).
145
147 This manual page was generated by the Netpbm tool 'makeman' from HTML
148 source. The master documentation is at
149
150 http://netpbm.sourceforge.net/doc/pamfix.html
151
152netpbm documentation 06 March 2014 Pamfix User Manual(0)