PBMMASK



		

NAME

      pbmmask - create a mask bitmap from a regular bitmap

SYNOPSIS

      pbmmask [pbmfile]

DESCRIPTION

      Reads a portable bitmap as input.  Creates a corresponding mask bitmap
      and writes it out.
      The color to be interpreted as "background" is determined
      automatically.  Regardless of which color is background, the mask will
      be white where the background is and black where the figure is.
      This lets you do a masked paste like this, for objects with a black
      background:
          pbmmask obj > objmask
          pbmpaste < dest -and objmask <x> <y> | pbmpaste -or obj <x> <y>
      For objects with a white background, you can either invert them or add
      a step:
          pbmmask obj > objmask
          pnminvert objmask | pbmpaste -and obj 0 0 > blackback
          pbmpaste < dest -and objmask <x> <y> | pbmpaste -or blackback <x> <y>
      Note that this three-step version works for objects with black
      backgrounds too, if you don't care about the wasted time.
      You can also use masks with graymaps and pixmaps, using the ppmarith
      tool.  For instance:
          ppmtopgm obj.ppm | pgmtopbm -threshold | pbmmask > objmask.pbm
          ppmarith -multiply dest.ppm objmask.pbm > t1.ppm
          pnminvert objmask.pbm | ppmarith -multiply obj.ppm - > t2.ppm
          ppmarith -add t1.ppm t2.ppm
      An interesting variation on this is to pipe the mask through the
      ppmsmooth script before using it.  This makes the boundary between the
      two images less sharp.

SEE ALSO

      pbmpaste(1), pnminvert(1), pbm(5), ppmarith(1)

AUTHOR

      Copyright (C) 1988 by Jef Poskanzer.
      Permission to use, copy, modify, and distribute this software and its
      documentation for any purpose and without fee is hereby granted,
      provided that the above copyright notice appear in all copies and that
      both that copyright notice and this permission notice appear in
      supporting documentation.  This software is provided "as is" without
      express or implied warranty.