# ppmcolormask - man - [phpMan]

> **TLDR:** Produce a mask of areas of a certain color in a PPM image.
>
- Produce a mask of areas of a certain color in the specified PPM image:
  `ppmcolormask {{-c|-color}} {{red,blue}} {{path/to/input.ppm}} > {{path/to/output.pbm}}`

*Source: tldr-pages*

---

_Ppmcolormask_ _User_ [_Manual_(1)](https://www.chedong.com/phpMan.php/man/Manual/1/markdown)            General Commands Manual           _Ppmcolormask_ _User_ [_Manual_(1)](https://www.chedong.com/phpMan.php/man/Manual/1/markdown)

## NAME
       ppmcolormask - produce mask of areas of a certain color in a PPM file


## SYNOPSIS
       **ppmcolormask -color=_**color_list_ [_ppmfile_]

       **ppmcolormask _**color_ [_ppmfile_]


## EXAMPLES
           ppmcolormask -color red testimg.ppm >redmask.pbm
           pamcomp background.ppm testimg.ppm -alpha=redmask.pbm >test.ppm

           ppmcolormask -color=red,pink,salmon testimg.ppm >reddishmask.pbm

           ppmcolormask -color=bk:red,bk:orange,bk:yellow testimg.ppm >firemask.pbm




## DESCRIPTION
       This program is part of [**Netpbm**(1)](https://www.chedong.com/phpMan.php/man/Netpbm/1/markdown).

       **ppmcolormask  **reads a PPM file as input and produces a PBM (bitmap) file as output.  The out‐
       put file is the same dimensions as the input file and is black in all places where the  input
       file is a color indicated by the **-color **option, and white everywhere else.

       The  output of **ppmcolormask **is useful as a transparency mask input to **pamcomp**.  Note that you
       don't need **ppmcolormask **and **pamcomp **if you are ultimately converting to PNG with **pnmtopng **be‐
       cause the **-transparent **option on **pnmtopng **does the same thing.

       _ppmfile_ is the input file.  If you don't specify _ppmfile_, the input is from Standard Input.

       The output goes to Standard Output.

       In the obsolete alternative syntax, specifying the _color_ names a single  exact  color  to  be
       masked.

       **ppmchange  **does a similar thing: it modifies an image by changing colors you specify to other
       colors you specify.  The two programs give you somewhat different means of specifying  colors
       in the input image.

       To make a mask of an image's background, without having to tell it what color it is, use **pam‐**
       **background**.


## OPTIONS
       In  addition  to  the options common to all programs based on libnetpbm (most notably **-quiet**,
       see [ Common Options](index.html#commonoptions) ), **ppmcolormask **recognizes the following command line option:



### -color=_
              This mandatory option specifies the colors that are to be masked (where the  image  is
              one of these colors, the output mask will be black).

              Examples:



       •      **-color=red**

       •      **-color=red,pink,salmon**

       •      **-color=rgb:80/80/ff**

       •      **-color=bk:red,bk:orange,bk:yellow**


              _color_list_  is  a  list  of colors separated by commas.  Each color is either an exact
              color name as described for the [argument of the **pnm_parsecolor() **library routine](libnetpbm_image.html#colorname)    or
              one  of  the  [Berlin-Kay color names](libppm.html#berlinkay) .  In the latter case, all colors that are better
              described by that Berlin-Kay color name than any other are in the mask set.

              The algorithm **ppmcolormask **uses to determine to which colors a Berlin-Kay  color  name
              applies  is based on a Sugeno-type fuzzy inference system developed by _Kenan_ _Kalajdzic_
              in 2006.  The fuzzy model consists of partially linear membership functions defined in
              the HSV color space.  Although more complex algorithms for fuzzy color matching exist,
              this algorithm is intentionally simplified to achieve a satisfactory speed using rela‐
              tively compact code.

              This option was new in Netpbm 10.34 (June 2006).  Before that, you must use the  _color_
              argument and cannot specify a Berlin-Kay color.




## SEE ALSO
       [**pamfind**(1)](https://www.chedong.com/phpMan.php/man/pamfind/1/markdown), [**pambackground**(1)](https://www.chedong.com/phpMan.php/man/pambackground/1/markdown), [**ppmchange**(1)](https://www.chedong.com/phpMan.php/man/ppmchange/1/markdown), [**pgmtoppm**(1)](https://www.chedong.com/phpMan.php/man/pgmtoppm/1/markdown), [**pamcomp**(1)](https://www.chedong.com/phpMan.php/man/pamcomp/1/markdown), [**pbmmask**(1)](https://www.chedong.com/phpMan.php/man/pbmmask/1/markdown), [**pnmtopng**(1)](https://www.chedong.com/phpMan.php/man/pnmtopng/1/markdown),
       [**ppm**(1)](https://www.chedong.com/phpMan.php/man/ppm/1/markdown)

## DOCUMENT SOURCE
       This  manual  page  was  generated by the Netpbm tool 'makeman' from HTML source.  The master
       documentation is at

              **<http://netpbm.sourceforge.net/doc/ppmcolormask.html>**

netpbm documentation                         01 May 2006                 _Ppmcolormask_ _User_ [_Manual_(1)](https://www.chedong.com/phpMan.php/man/Manual/1/markdown)
