Article View: comp.lang.postscript
Article #8945Re: How to paint a non-rectangular image?
From: Jef Poskanzer
Date: Sat, 10 Feb 1990 23:22
Date: Sat, 10 Feb 1990 23:22
32 lines
2019 bytes
2019 bytes
In the referenced message, amanda@mermaid.intercon.com (Amanda Walker) wrote:
}What I would do is to do two imagemask commands. The first paints the
}mask bitmap with white, and the second paints the image bitmap in black
}(or whatever).
Hmmmmmm.... This doesn't solve the precise problem I posed, since I
want to paint a grayscale image, but it's very close. With a little
image hacking using my PBMPLUS toolkit I was able to make this trick
work quite well. Thanks!
For the benefit of any other PBMPLUS/PostScript hackers out there
(and for my own future reference), here's what I did:
pgmtopbm face.pgm > face.pbm
{manually edit face.pbm to remove background, giving clipped.pbm}
pbmmask clipped.pbm | pnminvert > mask.pbm
pnmenlarge 5 face.pgm > face5.pgm
pnmenlarge 5 mask.pbm > mask5.pbm
ppmarith -mul face5.pgm mask5.pbm | ppmtopgm | pgmtopbm > clipped5.pbm
pgmtops mask5.pbm > mask5.ps
pgmtopbm clipped5.pbm > clipped5.ps
Then turn mask5.ps into an imagemask command with invert true and
0 setgray; turn clipped5.ps into an imagemask with invert true and
1 setgray; and adjust the translate and scale commands to shrink
the result back down by a factor of five.
---
Jef
Jef Poskanzer jef@well.sf.ca.us {ucbvax, apple, hplabs}!well!jef
A witty saying proves nothing, but saying something pointless gets
people's attention.
Technical Details
Message-ID:
<4833@helios.ee.lbl.gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!ucsd!helios.ee.lbl.gov!surf.ee.lbl.gov!jefReferences:
<1990Feb10.014607.7631@intercon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!ucsd!helios.ee.lbl.gov!surf.ee.lbl.gov!jef From: jef@surf.ee.lbl.gov (Jef Poskanzer) Newsgroups: comp.lang.postscript Subject: Re: How to paint a non-rectangular image? Message-ID: <4833@helios.ee.lbl.gov> Date: 10 Feb 90 23:22:24 GMT References: <1990Feb10.014607.7631@intercon.com> Sender: usenet@helios.ee.lbl.gov Reply-To: Jef Poskanzer <jef@well.sf.ca.us> Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 32 X-Local-Date: 10 Feb 90 15:22:24 PST