Linux Commands Examples

A great documentation place for Linux commands

pnmdepth

change the maxval in a portable anymap


see also : ppmquant - ppmdither

Synopsis

pnmdepth newmaxval [pnmfile]


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
*PBM* )
pnmdepth 255 "$file"
exit 0
;;
*PGM* )
cat "$file"
exit 0
;;
*PPM* )
ppmtopgm "$file"
0
source
            
/usr/local/netpbm/bin/pnmdepth 255 | \
/usr/local/netpbm/bin/pnmscale $scale | \
/usr/local/netpbm/bin/pnmtops -width 8 -height 11 $direction $where |\
0
source
            
ppmtopgm | pnmdepth 255 | \
pnmtops -noturn -width 100 -height 100 > $@ || rm -f $@
%.ps: $(srcdir)/../herds/%.png $(srcdir)/../herds/convol5.pnm
pnmconvol $(srcdir)/../herds/convol5.pnm | ppmtopgm | \
pnmdepth 255 | pnmtops -width 100 -height 100 -noturn > $@ || rm -f $@
%.ps: $(srcdir)/../screen/%.png
0
source
            
ppmtopgm | pnmdepth 255 | \
pnmtops -noturn -width 100 -height 100 > $@ || rm -f $@
%.ps: $(srcdir)/../herds/%.png $(srcdir)/../herds/convol5.pnm
pnmconvol $(srcdir)/../herds/convol5.pnm | ppmtopgm | \
pnmdepth 255 | pnmtops -width 100 -height 100 -noturn > $@ || rm -f $@
%.ps: $(srcdir)/../screen/%.png
0
source
            
pgmnorm pgmoil pgmslice pnmarith pnmcut pnmdepth pnmenlarge pnmfile \\\
pnminterp pnmnoraw pnmscale pnmsplit pnmtofits pnmtojpeg pnmtopnm pnmtops \\\

description

Reads a portable anymap as input. Scales all the pixel values, and writes out the image with the new maxval. Scaling the colors down to a smaller maxval will result in some loss of information.

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 pnmdepth 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.


see also

pnm, ppmquant , ppmdither


author

Copyright (C) 1989, 1991 by Jef Poskanzer.

How can this site be more helpful to YOU ?


give  feedback