{
    "content": [
        {
            "type": "text",
            "text": "# pbmmask(1) (man)\n\n## TLDR\n\n> Create a mask bitmap from a regular bitmap.\n\n- Create a mask bitmap separating background from foreground:\n  `pbmmask {{path/to/image.pbm}} > {{path/to/output.pbm}}`\n- Expand the generated mask by one pixel:\n  `pbmmask {{-r|-expand}} {{path/to/image.pbm}} > {{path/to/output.pbm}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** pbmmask - create a mask bitmap from a regular bitmap\n\n**Synopsis:** pbmmask [-expand] [pbmfile]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| — | — | — | Expands the mask by one pixel out from the image. This is useful if you want a little white border around your image. (A |\n\n## See Also\n\n- ppmcolormask(1)\n- pnmpaste(1)\n- pnminvert(1)\n- pbm(5)\n- pnmarith(1)\n- pnmsmooth(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (26 lines)\n- **OPTIONS** (1 lines) — 1 subsections\n  - -expand (6 lines)\n- **SEE ALSO** (2 lines)\n- **AUTHOR** (5 lines)\n\n## Full Content\n\n### NAME\n\npbmmask - create a mask bitmap from a regular bitmap\n\n### SYNOPSIS\n\npbmmask [-expand] [pbmfile]\n\n### DESCRIPTION\n\nReads a portable bitmap as input.  Creates a corresponding mask bitmap and writes it out.\n\nThe color to be interpreted as \"background\" is determined automatically.  Regardless of which\ncolor is background, the mask will be white where the background is and black where the  fig‐\nure is.\n\nThis lets you do a masked paste like this, for objects with a black background:\npbmmask obj > objmask\npnmpaste < dest -and objmask <x> <y> | pnmpaste -or obj <x> <y>\nFor objects with a white background, you can either invert them or add a step:\npbmmask obj > objmask\npnminvert objmask | pnmpaste -and obj 0 0 > blackback\npnmpaste < dest -and objmask <x> <y> | pnmpaste -or blackback <x> <y>\nNote  that this three-step version works for objects with black backgrounds too, if you don't\ncare about the wasted time.\n\nYou can also use masks with graymaps and pixmaps, using the pnmarith tool.  For instance:\nppmtopgm obj.ppm | pgmtopbm -threshold | pbmmask > objmask.pbm\npnmarith -multiply dest.ppm objmask.pbm > t1.ppm\npnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm\npnmarith -add t1.ppm t2.ppm\nAn interesting variation on this is to pipe the mask through the pnmsmooth script before  us‐\ning it.  This makes the boundary between the two images less sharp.\n\n### OPTIONS\n\n#### -expand\n\nExpands the mask by one pixel out from the image.  This is useful if you want a little\nwhite border around your image.  (A better solution might be to turn the pbmlife  tool\ninto a general cellular automaton tool...)\n\n### SEE ALSO\n\nppmcolormask(1), pnmpaste(1), pnminvert(1), pbm(5), pnmarith(1), pnmsmooth(1)\n\n### AUTHOR\n\nCopyright (C) 1988 by Jef Poskanzer.\n\n\n\n08 August 1989                                 pbmmask(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "pbmmask",
        "section": "1",
        "mode": "man",
        "summary": "pbmmask - create a mask bitmap from a regular bitmap",
        "synopsis": "pbmmask [-expand] [pbmfile]",
        "tldr_summary": "Create a mask bitmap from a regular bitmap.",
        "tldr_examples": [
            {
                "description": "Create a mask bitmap separating background from foreground",
                "command": "pbmmask {{path/to/image.pbm}} > {{path/to/output.pbm}}"
            },
            {
                "description": "Expand the generated mask by one pixel",
                "command": "pbmmask {{-r|-expand}} {{path/to/image.pbm}} > {{path/to/output.pbm}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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 pbmlife tool into a general cellular automaton tool...)"
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "ppmcolormask",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppmcolormask/1/json"
            },
            {
                "name": "pnmpaste",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmpaste/1/json"
            },
            {
                "name": "pnminvert",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnminvert/1/json"
            },
            {
                "name": "pbm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/pbm/5/json"
            },
            {
                "name": "pnmarith",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmarith/1/json"
            },
            {
                "name": "pnmsmooth",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmsmooth/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 26,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-expand",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}