1Pamdepth User Manual(0) Pamdepth User Manual(0)
2
3
4
6 pamdepth - change the depth (color resolution) in a Netpbm image
7
8
10 pamdepth newmaxval [netpbmfile]
11
12
14 This program is part of Netpbm(1).
15
16 pamdepth reads a Netpbm image as input, changes its depth (color reso‐
17 lution), and writes out the resulting Netpbm image. I.e. the output
18 has a different maxval from the input, but all the same colors (apart
19 from rounding error).
20
21 Reducing the depth results in some loss of information.
22
23 Here is an example of the effect at the image format level: Assume you
24 start with an image with maxval 100 and sample values of 50 and 100.
25 You tell pamdepth to change it to depth 150. The output has maxval 200
26 and sample values 75 and 150.
27
28 This program works on multi-image streams.
29
30 Be careful of off-by-one errors when choosing the new maxval. For
31 instance, if you want the color values to be five bits wide, use a max‐
32 val of 31, not 32.
33
34 One important use of pamdepth is to convert a new format 2-byte-per-
35 sample PNM file to the older 1-byte-per-sample format. Before April
36 2000, essentially all raw (binary) format PNM files had a maxval less
37 than 256 and one byte per sample, and many programs may rely on that.
38 If you specify a newmaxval less than 256, the resulting file should be
39 readable by any program that worked with PNM files before April 2000.
40
41
42 Output Format
43 The output format (PBM, etc.) and, in the case of PAM, tuple type, of
44 the output is usually the same as the input.
45
46 However, changing the depth of a black and white image does not make
47 sense, except to turn it into a grayscale image, so if the input is a
48 black and white image, pamdepth makes the output grayscale. To be more
49 precise, if the input is a PBM image, the output is PGM, and if the
50 input is a PAM with tuple type BLACK_AND_WHITE or
51 BLACK_AND_WHITE_ALPHA, the output is a PAM with tuple type GRAYSCALE or
52 GRAYSCALE_ALPHA, respectively.
53
54 This conversion happens even if the new maxval is 1.
55
56 Before Netpbm 10.92 (September 2020), pamdepth failed if the input was
57 PAM with a black and white tuple type and the new maxval was anything
58 but 1. But it always promoted PBM to PGM.
59
60
61
63 There are no command line options defined specifically for pamdepth,
64 but it recognizes the options common to all programs based on libnetpbm
65 (See
66 Common Options ⟨index.html#commonoptions⟩ .)
67
68
70 pnm(1), pam(1), pnmquant(1), ppmdither(1) pambrighten(1) pamfunc(1)
71
72
74 pamdepth was new in Netpbm 10.32 (February 2006). It replaced
75 pnmdepth, by Jef Poskanzer. pamdepth is backward compatible with
76 pnmdepth and adds the ability to process arbitrary PAM images and the
77 ability to process multi-image input streams. pnmdepth handled only
78 PNM images and ignored all but the first in any stream.
79
81 This manual page was generated by the Netpbm tool 'makeman' from HTML
82 source. The master documentation is at
83
84 http://netpbm.sourceforge.net/doc/pamdepth.html
85
86netpbm documentation 26 August 2020 Pamdepth User Manual(0)