Bash Cures Cancer
Learn the UNIX/Linux command line

Home     Man Pages     SpamDefeator


				  pamditherbw

   Updated: 20 June 2004
   Table Of Contents

NAME

   pamditherbw - dither grayscale image to black and white

SYNOPSIS

   pamditherbw	[-floyd	 | -fs | -threshold | -hilbert | -dither8
| -d8 |
   -cluster3 | -c3 | -cluster4 | -c4 | -cluster8 |  -c8]  [-value
val] [-clump
   size] [pamfile]

DESCRIPTION

   This program is part of Netpbm.

   pamditherbw dithers a grayscale image. Dithering means turning
each shade of
   gray into a pattern of black and white  pixels  that,  from	a
distance, look
   the same as the gray.

   The	input  should be a PGM image or a PAM image of tuple type
GRAYSCALE.
   However, pamditherbw doesn't check, so if you feed it  e.g.	a
PPM image, it
   will	 produce  arbitrary  results (actually, it just takes the
first channel of
   whatever you give it and treats it as if it	represented  gray
levels).

   The	output	is  a  PAM with tuple type BLACKANDWHITE. You can
turn this into a
   PBM (if you need to use it with an older program  doesn't  un-
derstand PAM)
   with pamtopnm.

   To  do  the	opposite of dithering, you can usually just scale
the image down
   and then back up again with pamscale,  possibly  smoothing  or
blurring the
   result  with	 pnmsmooth  or pnmconvol. Or use the special case
program
   pbmtopgm.

   To  dither  a  color image (to reduce the number of pixel col-
ors), use
   ppmdither.

OPTIONS

   The	default	 quantization  method  is  boustrophedonic Floyd-
Steinberg error
   diffusion (-floyd or -fs).

   Also available are simple thresholding  (-threshold);  Bayer's
ordered dither
   (-dither8)  with  a 16x16 matrix; and three different sizes of
45-degree
   clustered-dot dither (-cluster3, -cluster4, -cluster8).

   A space filling curve  halftoning  method  using  the  Hilbert
curve is also
   available (-hilbert).

   Floyd-Steinberg  will  almost always give the best looking re-
sults; however,
   looking good is  not	 always	 what  you  want.  For	instance,
thresholding can be
   used	 in  a	pipeline  with the pnmconvol tool, for tasks like
edge and peak
   detection. And clustered-dot dithering gives	 a  newspaper-ish
look, a useful
   special effect.

   The	-value	option	alters	the thresholding value for Floyd-
Steinberg and
   simple thresholding. It should be a real number between 0  and
1. Above 0.5
   means darker images; below 0.5 means lighter.

   The	Hilbert	 curve method is useful for processing images be-
fore display on
   devices  that  do  not  render  individual  pixels  distinctly
(like laser
   printers).  This dithering method can give better results than
the dithering
   usually done by the laser printers themselves. The -clump  op-
tion alters the
   number  of  pixels  in a clump. This is usually an integer be-
tween 2 and 100
   (default 5). Smaller clump sizes smear the image less and  are
less grainy,
   but	seem  to loose some grey scale linearity. Typically a PGM
image will have
   to be scaled to fit on a laser printer page (2400 x 3000  pix-
els for an A4
   300	dpi  page), and then dithered to a PBM image before being
converted to a
   postscript file. A  printing	 pipeline  might  look	something
like:
    pamscale -xysize 2400 3000 image.pgm | pamditherbw -hilbert |
pamtopnm | pnmtops -scale 0.25 > image.ps

   All options can be abbreviated to their shortest  unique  pre-
fix.

REFERENCES

   The	only  reference	 you  need  for	 this  stuff  is "Digital
Halftoning" by Robert
   Ulichney, MIT Press, ISBN 0-262-21009-6.

   The Hilbert curve space filling method is taken from	 "Digital
Halftoning
   with	 Space	Filling	 Curves" by Luiz Velho, Computer Graphics
Volume 25,
   Number  4,  proceedings  of	SIGRAPH	 '91,	page   81.   ISBN
0-89791-436-8

SEE ALSO

   pamtopnm,  pgmtopgm, pbmtopgm, pbmreduce, pnmconvol, pamscale,
pam, pnm,

HISTORY

   pamditherbw was new in Netpbm 10.23 (July 2004), but is essen-
tially the same
   program   as	 pgmtopbm  that has existed practically since the
beginning.
   pamditherbw differs from its predecessor in that  it	 properly
deals with
   gamma  adjustment and that it accepts PAM input in addition to
PGM and PBM
   and produces PAM output.

   pamditherbw obsoletes pgmtopbm.

AUTHOR

   Copyright (C) 1989 by Jef Poskanzer.
     _________________________________________________________________



Table Of Contents

     * NAME
     * SYNOPSIS
     * DESCRIPTION
     * OPTIONS
     * REFERENCES
     * SEE ALSO
     * AUTHOR







































UNIX/Linux commands referenced on this page:
  1. as
  2. pamscale
  3. pnmsmooth
  4. pnmconvol
  5. display
  6. less
  7. pnmtops
  8. pamtopnm
  9. pgmtopgm
  10. pbmtopgm
  11. pbmreduce
  12. pgmtopbm