1Pamfixtrunc User Manual(0) Pamfixtrunc User Manual(0)
2
3
4
6 pamfixtrunc - repair a Netpbm image whose file is truncated
7
8
10 pamfixtrunc
11
12 [-verbose]
13
14 [netpbmfile]
15
16
18 This program is part of Netpbm(1).
19
20 pamfixtrunc reads as much as it can of a Netpbm image that may be trun‐
21 cated (i.e. the file may not contain the last part of the image) and
22 writes out a valid Netpbm image that is just missing the bottom rows of
23 the original (pre-truncation) image.
24
25 The header of a Netpbm image implies how large the image must be (how
26 many bytes the file must contain). If the file is actually smaller
27 than that, a Netpbm program that tries to read the image fails, with an
28 error message telling you that it couldn't read the whole file. The
29 data in the file is arranged in row order, from top to bottom, and the
30 most common reason for the file being smaller than its header says it
31 should be is because the bottommost rows are simply missing. So pam‐
32 fixtrunc assumes that is the case and generates a new image with just
33 the rows that are readable. (technically, that means the output's
34 header indicates a smaller number of rows and omits any partial last
35 row).
36
37 The most common way for a Netpbm file to be small is that something
38 interrupted the program that generated it before it was finished writ‐
39 ing the file. For example, the program ran out of its own input or
40 encountered a bug or ran out of space in which to write the output.
41
42 Another problem pamfixtrunc deals with is where the file isn't actually
43 too small, but due to a system error, a byte in the middle of it cannot
44 be read (think of a disk storage failure). pamfixtrunc reads the input
45 sequentially until it can't read any further, for any reason. So it
46 treats such an image as a truncated one, ignoring all data after the
47 unreadable byte.
48
49 But be aware that an image file is sometimes too small because of a bug
50 in the program that generated it, and in that case it is not simply a
51 matter of the bottom of the image missing, so pamfixtrunc simply cre‐
52 ates a valid Netpbm image containing a garbage picture.
53
54 pamfixtrunc looks at only on the first image in a multi-image stream.
55
56 If you want to test an image file to see if it is corrupted by being
57 too small, use pamfile --allimages . It fails with an error message if
58 the file is too small.
59
60 If you want to cut the bottom off a valid Netpbm image, use pamcut.
61
62
64 pnm(1), pam(1), pamcut(1), pamfile(1),
65
66
68 pamfixtrunc was new in Netpbm 10.38 (March 2007).
69
70
71
72netpbm documentation 06 January 2006 Pamfixtrunc User Manual(0)