135 lines
3.3 KiB
HTML
135 lines
3.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pbmmask</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pbmmask</H1>
|
|
Section: User Commands (1)<BR>Updated: 08 August 1989<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="ixAAB"></A>
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pbmmask - create a mask bitmap from a regular bitmap
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>pbmmask</B>
|
|
|
|
[<B>-expand</B>]
|
|
|
|
[<I>pbmfile</I>]
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Reads a portable bitmap as input.
|
|
Creates a corresponding mask bitmap and writes it out.
|
|
<P>
|
|
|
|
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.
|
|
<P>
|
|
|
|
This lets you do a masked paste like this, for objects with a black background:
|
|
<PRE>
|
|
pbmmask obj > objmask
|
|
pnmpaste < dest -and objmask <x> <y> | pnmpaste -or obj <x> <y>
|
|
</PRE>
|
|
|
|
<A NAME="ixAAC"></A>
|
|
For objects with a white background, you can either invert them or
|
|
add a step:
|
|
<PRE>
|
|
pbmmask obj > objmask
|
|
pnminvert objmask | pnmpaste -and obj 0 0 > blackback
|
|
pnmpaste < dest -and objmask <x> <y> | pnmpaste -or blackback <x> <y>
|
|
</PRE>
|
|
|
|
<A NAME="ixAAD"></A>
|
|
Note that this three-step version works for objects with black backgrounds
|
|
too, if you don't care about the wasted time.
|
|
<P>
|
|
|
|
You can also use masks with graymaps and pixmaps, using the
|
|
<I>pnmarith</I>
|
|
|
|
tool. For instance:
|
|
<PRE>
|
|
ppmtopgm obj.ppm | pgmtopbm -threshold | pbmmask > objmask.pbm
|
|
pnmarith -multiply dest.ppm objmask.pbm > t1.ppm
|
|
pnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm
|
|
pnmarith -add t1.ppm t2.ppm
|
|
</PRE>
|
|
|
|
<A NAME="ixAAE"></A>
|
|
An interesting variation on this is to pipe the mask through the
|
|
<I>pnmsmooth</I>
|
|
|
|
<A NAME="ixAAF"></A>
|
|
script before using it. This makes the boundary between the two images less
|
|
sharp.
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-expand</B>
|
|
|
|
<DD>
|
|
Expands the mask by one pixel out from the image.
|
|
This is useful if you want a little white border around your image.
|
|
(A better solution might be to turn the
|
|
<I>pbmlife</I>
|
|
|
|
tool into a general cellular automaton tool...)
|
|
<P>
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmcolormask">ppmcolormask</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmpaste">pnmpaste</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnminvert">pnminvert</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+pbm">pbm</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmarith">pnmarith</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmsmooth">pnmsmooth</A></B>(1)
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Copyright (C) 1988 by Jef Poskanzer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="2"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="5"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="6"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
<DT id="7"><A HREF="#lbAG">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:21 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|