{
    "mode": "man",
    "parameter": "ppmcolormask",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/ppmcolormask/json",
    "generated": "2026-10-05T05:42:10Z",
    "synopsis": "ppmcolormask -color=colorlist [ppmfile]\nppmcolormask color [ppmfile]",
    "sections": {
        "NAME": {
            "content": "ppmcolormask - produce mask of areas of a certain color in a PPM file\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ppmcolormask -color=colorlist [ppmfile]\n\nppmcolormask color [ppmfile]\n\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "ppmcolormask -color red testimg.ppm >redmask.pbm\npamcomp background.ppm testimg.ppm -alpha=redmask.pbm >test.ppm\n\nppmcolormask -color=red,pink,salmon testimg.ppm >reddishmask.pbm\n\nppmcolormask -color=bk:red,bk:orange,bk:yellow testimg.ppm >firemask.pbm\n\n\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\nppmcolormask  reads a PPM file as input and produces a PBM (bitmap) file as output.  The out‐\nput file is the same dimensions as the input file and is black in all places where the  input\nfile is a color indicated by the -color option, and white everywhere else.\n\nThe  output of ppmcolormask is useful as a transparency mask input to pamcomp.  Note that you\ndon't need ppmcolormask and pamcomp if you are ultimately converting to PNG with pnmtopng be‐\ncause the -transparent option on pnmtopng does the same thing.\n\nppmfile is the input file.  If you don't specify ppmfile, the input is from Standard Input.\n\nThe output goes to Standard Output.\n\nIn the obsolete alternative syntax, specifying the color names a single  exact  color  to  be\nmasked.\n\nppmchange  does a similar thing: it modifies an image by changing colors you specify to other\ncolors you specify.  The two programs give you somewhat different means of specifying  colors\nin the input image.\n\nTo make a mask of an image's background, without having to tell it what color it is, use pam‐\nbackground.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "In  addition  to  the options common to all programs based on libnetpbm (most notably -quiet,\nsee  Common Options ), ppmcolormask recognizes the following command line option:\n\n\n",
            "subsections": [
                {
                    "name": "-color=_",
                    "content": "This mandatory option specifies the colors that are to be masked (where the  image  is\none of these colors, the output mask will be black).\n\nExamples:\n\n\n\n•      -color=red\n\n•      -color=red,pink,salmon\n\n•      -color=rgb:80/80/ff\n\n•      -color=bk:red,bk:orange,bk:yellow\n\n\ncolorlist  is  a  list  of colors separated by commas.  Each color is either an exact\ncolor name as described for the argument of the pnmparsecolor() library routine    or\none  of  the  Berlin-Kay color names .  In the latter case, all colors that are better\ndescribed by that Berlin-Kay color name than any other are in the mask set.\n\nThe algorithm ppmcolormask uses to determine to which colors a Berlin-Kay  color  name\napplies  is based on a Sugeno-type fuzzy inference system developed by Kenan Kalajdzic\nin 2006.  The fuzzy model consists of partially linear membership functions defined in\nthe HSV color space.  Although more complex algorithms for fuzzy color matching exist,\nthis algorithm is intentionally simplified to achieve a satisfactory speed using rela‐\ntively compact code.\n\nThis option was new in Netpbm 10.34 (June 2006).  Before that, you must use the  color\nargument and cannot specify a Berlin-Kay color.\n\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "pamfind(1), pambackground(1), ppmchange(1), pgmtoppm(1), pamcomp(1), pbmmask(1), pnmtopng(1),\nppm(1)\n",
            "subsections": []
        },
        "DOCUMENT SOURCE": {
            "content": "This  manual  page  was  generated by the Netpbm tool 'makeman' from HTML source.  The master\ndocumentation is at\n\nhttp://netpbm.sourceforge.net/doc/ppmcolormask.html\n\nnetpbm documentation                         01 May 2006                 Ppmcolormask User Manual(1)",
            "subsections": []
        }
    },
    "summary": "ppmcolormask - produce mask of areas of a certain color in a PPM file",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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 colorlist is a list of colors separated by commas. Each color is either an exact color name as described for the argument of the pnmparsecolor() library routine or one of the Berlin-Kay color names . 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."
        }
    ],
    "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"
    ],
    "see_also": [
        {
            "name": "pamfind",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamfind/1/json"
        },
        {
            "name": "pambackground",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pambackground/1/json"
        },
        {
            "name": "ppmchange",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmchange/1/json"
        },
        {
            "name": "pgmtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgmtoppm/1/json"
        },
        {
            "name": "pamcomp",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamcomp/1/json"
        },
        {
            "name": "pbmmask",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pbmmask/1/json"
        },
        {
            "name": "pnmtopng",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmtopng/1/json"
        },
        {
            "name": "ppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Produce a mask of areas of a certain color in a PPM image.",
        "examples": [
            {
                "description": "Produce a mask of areas of a certain color in the specified PPM image",
                "command": "ppmcolormask {{-c|-color}} {{red,blue}} {{path/to/input.ppm}} > {{path/to/output.pbm}}"
            }
        ]
    }
}