1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it! If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pamdepth User Manual" 0 "26 August 2020" "netpbm documentation"
.SH NAME
pamdepth - change the depth (color resolution) in a Netpbm image
.UN synopsis
.SH SYNOPSIS
\fBpamdepth\fP \fInewmaxval\fP [\fInetpbmfile\fP]
.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpamdepth\fP reads a Netpbm image as input, changes its depth (color
resolution), and writes out the resulting Netpbm image. I.e. the output has a
different maxval from the input, but all the same colors (apart from rounding
error).
.PP
Reducing the depth results in some loss of information.
.PP
Here is an example of the effect at the image format level: Assume you
start with an image with maxval 100 and sample values of 50 and 100. You
tell \fBpamdepth\fP to change it to depth 150. The output has maxval
200 and sample values 75 and 150.
.PP
This program works on multi-image streams.
.PP
Be careful of off-by-one errors when choosing the new maxval. For
instance, if you want the color values to be five bits wide, use a
maxval of 31, not 32.
.PP
One important use of \fBpamdepth\fP is to convert a new format
2-byte-per-sample PNM file to the older 1-byte-per-sample format.
Before April 2000, essentially all raw (binary) format PNM files had a
maxval less than 256 and one byte per sample, and many programs may
rely on that. If you specify a \fInewmaxval\fP less than 256, the
resulting file should be readable by any program that worked with PNM
files before April 2000.
.UN output_format
.SS Output Format
.PP
The output format (PBM, etc.) and, in the case of PAM, tuple type, of the
output is usually the same as the input.
.PP
However, changing the depth of a black and white image does not make
sense, except to turn it into a grayscale image, so if the input is a black
and white image, \fBpamdepth\fP makes the output grayscale. To be more
precise, if the input is a PBM image, the output is PGM, and if the input
is a PAM with tuple type BLACK_AND_WHITE or BLACK_AND_WHITE_ALPHA, the
output is a PAM with tuple type GRAYSCALE or GRAYSCALE_ALPHA, respectively.
.PP
This conversion happens even if the new maxval is 1.
.PP
Before Netpbm 10.92 (September 2020), \fBpamdepth\fP failed if the input
was PAM with a black and white tuple type and the new maxval was anything but
1. But it always promoted PBM to PGM.
.UN options
.SH OPTIONS
.PP
There are no command line options defined specifically
for \fBpamdepth\fP, but it recognizes the options common to all
programs based on libnetpbm (See
.UR index.html#commonoptions
Common Options
.UE
\&.)
.UN seealso
.SH SEE ALSO
.BR "pnm" (5)\c
\&,
.BR "pam" (5)\c
\&,
.BR "pnmquant" (1)\c
\&,
.BR "ppmdither" (1)\c
\&
.BR "pambrighten" (1)\c
\&
.BR "pamfunc" (1)\c
\&
.UN history
.SH HISTORY
.PP
\fBpamdepth\fP was new in Netpbm 10.32 (February 2006). It replaced
\fBpnmdepth\fP, by Jef Poskanzer. \fBpamdepth\fP is backward compatible
with \fBpnmdepth\fP and adds the ability to process arbitrary PAM images
and the ability to process multi-image input streams. \fBpnmdepth\fP
handled only PNM images and ignored all but the first in any stream.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source. The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pamdepth.html
.PP
|