Linux Commands Examples

A great documentation place for Linux commands

ppmcolormask

produce mask of areas of a certain color in a PPM file


see also : pgmtoppm - pnmcomp - pbmmask

Synopsis

ppmcolormask color [ppmfile]


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
colors="rgbi:1/0/0 rgbi:1/0/1 rgbi:0/0/1 rgbi:0/1/1 rgbi:0/1/0 rgbi:1/1/0 rgbi:.5/0/0 rgbi:.5/0/.5 rgbi:0/0/.5 rgbi:0/.5/.5 rgbi:0/.5/0 rgbi:.5/.5/0"
i=0
for color in $colors; do
cmask[$i]="$tmpdir/cmask$i.pbm"
ppmcolormask $color $cutout | pnminvert > ${cmask[$i]}

description

Reads a PPM file as input. Produces a PBM (bitmap) file as output. The output file is the same dimensions as the input file and is black in all places where the input file is the color color, and white everywhere else.

The output of ppmcolormask is useful as an alpha mask input to pnmcomp. Note that you can generate such an alpha mask automatically as you convert to PNG format with pnmtopng(1). Use its -transparent option.

ppmfile is the input file. If you don’t specify ppmfile, the input is from Standard Input.

The output goes to Standard Output.

You can specify color five ways:

o

An X11-style color name (e.g. black).

o

An X11-style hexadecimal specifier: rgb:r/g/b, where r g and b are each 1- to 4-digit hexadecimal numbers.

o

An X11-style decimal specifier: rgbi:r/g/b, where r g and b are floating point numbers between 0 and 1.

o

For backwards compatibility, an old-X11-style hexadecimal number: #rgb, #rrggbb, #rrrgggbbb, or #rrrrggggbbbb.

o

For backwards compatibility, a triplet of numbers separated by commas: r,g,b, where r g and b are floating point numbers between 0 and 1. (This style was added before MIT came up with the similar rgbi style.)


see also

pgmtoppm , pnmcomp , pbmmask , ppm


author

Bryan Henderson (bryanh@giraffe-data.com)

How can this site be more helpful to YOU ?


give  feedback