Pamdepth User Manual

Pamdepth User Manual



pamdepth - change the depth (color resolution) in a Netpbm image


pamdepth newmaxval [netpbmfile]


This program is part of Netpbm(1)

pamdepth 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).

Reducing the depth results in some loss of information.

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 pamdepth to change it to depth 150. The output has maxval 200 and sample values 75 and 150.

This program works on multi-image streams.

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.

One important use of pamdepth 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 newmaxval less than 256, the resulting file should be readable by any program that worked with PNM files before April 2000.


pnm(5) , pam(5) , pnmquant(1) , ppmdither(1)




pamdepth was new in Netpbm 10.32 (February 2006). It replaced pnmdepth, by Jef Poskanzer. pamdepth is backward compatible with pnmdepth and adds the ability to process arbitrary PAM images and the ability to process multi-image input streams. pnmdepth handled only PNM images and ignored all but the first in any stream.

More Linux Commands

dgst(1ssl) - message digests (Commands - Linux man page)....
The digest functions output the message digest of a supplied file or files in hexadecimal. The digest functions also generate and verify digital signatures usin

index(3) - locate character in string - Linux manual page...
The index() function returns a pointer to the first occurrence of the character c in the string s. The rindex() function returns a pointer to the last occurrenc

is(n) - test argument to see if it is a class or an object
The is command is used to check if the argument given is a class or an object; depending on the option given. If the argument if a class or object, then 1 is re

MIME::Decoder::Binary(3pm) - perform no encoding/decoding...
A MIME::Decoder subclass for the binary encoding (in other words, no encoding). The binary decoder is a special case, since its ill-advised to read the input li

glTexImage1D(3gl) - specify a one-dimensional texture image
Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable one-dimensional textur

stdscr(3ncurses) - curses global variables - Linux man page
This page summarizes variables provided by the curses library. A more complete description is given in the curses(3X) manual page. Depending on the configuratio

bind_textdomain_codeset(3) - set encoding of message transla
The bind_textdomain_codeset function sets the output codeset for message catalogs for domain domainname. A message domain is a set of translatable msgid message

CMSG_SPACE(3) - Access ancillary data - Linux manual page...
These macros are used to create and access control messages (also called ancillary data) that are not a part of the socket payload. This control information may

sasl_server_init(3) - SASL server authentication initializat
sasl_server_init() initializes SASL. It must be called before any calls to sasl_server_start, and only once per process. This call initializes all SASL mechanis

XSetWMName(3) - set or read a window's WM_NAME property.....
The XSetWMName convenience function calls XSetTextProperty to set the WM_NAME property. The XGetWMName convenience function calls XGetTextProperty to obtain the

Tk_SetWindowBackgroundPixmap(3) - change window configuratio
These procedures are analogous to the X library procedures with similar names, such as XConfigureWindow. Each one of the above procedures calls the correspondin

installsieve(1) - user utility for managing sieve scripts...
installsieve is a utility that allows users to manage their sieve scripts kept on the server. OPTIONS -v <name> View script with the given name. The script if r

We can't live, work or learn in freedom unless the software we use is free.