home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / netpbm_docs.lzh / NETPBM / DOCS / pbmmask.1 < prev    next >
Text File  |  1996-11-18  |  2KB  |  67 lines

  1. .TH pbmmask 1 "08 August 1989"
  2. .IX pbmmask
  3. .SH NAME
  4. pbmmask - create a mask bitmap from a regular bitmap
  5. .SH SYNOPSIS
  6. .B pbmmask
  7. .RB [ -expand ]
  8. .RI [ pbmfile ]
  9. .SH DESCRIPTION
  10. Reads a portable bitmap as input.
  11. Creates a corresponding mask bitmap and writes it out.
  12. .PP
  13. The color to be interpreted as "background" is determined automatically.
  14. Regardless of which color is background, the mask will be white where
  15. the background is and black where the figure is.
  16. .PP
  17. This lets you do a masked paste like this, for objects with a black background:
  18. .nf
  19.     pbmmask obj > objmask
  20.     pnmpaste < dest -and objmask <x> <y> | pnmpaste -or obj <x> <y>
  21. .fi
  22. .IX pnmpaste
  23. For objects with a white background, you can either invert them or
  24. add a step:
  25. .nf
  26.     pbmmask obj > objmask
  27.     pnminvert objmask | pnmpaste -and obj 0 0 > blackback
  28.     pnmpaste < dest -and objmask <x> <y> | pnmpaste -or blackback <x> <y>
  29. .fi
  30. .IX pnminvert
  31. Note that this three-step version works for objects with black backgrounds
  32. too, if you don't care about the wasted time.
  33. .PP
  34. You can also use masks with graymaps and pixmaps, using the
  35. .I pnmarith
  36. tool.  For instance:
  37. .nf
  38.     ppmtopgm obj.ppm | pgmtopbm -threshold | pbmmask > objmask.pbm
  39.     pnmarith -multiply dest.ppm objmask.pbm > t1.ppm
  40.     pnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm
  41.     pnmarith -add t1.ppm t2.ppm
  42. .fi
  43. .IX pnmarith
  44. An interesting variation on this is to pipe the mask through the
  45. .I pnmsmooth
  46. .IX pnmsmooth
  47. script before using it.  This makes the boundary between the two images less
  48. sharp.
  49. .OPTIONS
  50. .TP
  51. .B -expand
  52. Expands the mask by one pixel out from the image.
  53. This is useful if you want a little white border around your image.
  54. (A better solution might be to turn the
  55. .I pbmlife
  56. tool into a general cellular automaton tool...)
  57. .SH "SEE ALSO"
  58. pnmpaste(1), pnminvert(1), pbm(5), pnmarith(1), pnmsmooth(1)
  59. .SH AUTHOR
  60. Copyright (C) 1988 by Jef Poskanzer.
  61. .\" Permission to use, copy, modify, and distribute this software and its
  62. .\" documentation for any purpose and without fee is hereby granted, provided
  63. .\" that the above copyright notice appear in all copies and that both that
  64. .\" copyright notice and this permission notice appear in supporting
  65. .\" documentation.  This software is provided "as is" without express or
  66. .\" implied warranty.
  67.