{
    "content": [
        {
            "type": "text",
            "text": "# pnmremap (man)\n\n## NAME\n\npnmremap - replace colors in a PPM image with colors from another set\n\n## SYNOPSIS\n\npnmremap  [-floyd|-fs|-nfloyd|-nofs]  [-firstisdefault] [-verbose] [-mapfile=mapfile] [-miss-\ningcolor=color] [pnmfile]\nAll options can be abbreviated to their shortest unique prefix.  You may use two hyphens  in-\nstead  of  one  to designate an option.  You may use either white space or an equals sign be-\ntween an option name and its value.\n\n## DESCRIPTION\n\npnmremap replaces the colors in an input image with those from a colormap you specify.  Where\na  color  in  the input is not in the colormap, you have three choices: 1) choose the closest\ncolor from the colormap; 2) choose the first color from the colormap; 3) use a  color  speci-\nfied  by  a  command  option.   (In this latter case, if the color you specify is not in your\ncolor map, the output will not necessarily contain only colors from the colormap).\n\n## TLDR\n\n> Replace the colors in a PNM image.\n\n- Replace the colors in an image with those in the specified color palette:\n  `pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{path/to/input.pnm}} > {{path/to/output.pnm}}`\n- Use Floyd-Steinberg dithering for representing colors missing in the color palette:\n  `pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{-fs|-floyd}} {{path/to/input.pnm}} > {{path/to/output.pnm}}`\n- Use the first color in the palette for representing colors missing in the color palette:\n  `pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{-fi|-firstisdefault}} {{path/to/input.pnm}} > {{path/to/output.pnm}}`\n- Use the specified color for representing colors missing in the color palette:\n  `pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{-m|-missingcolor}} {{color}} {{path/to/input.pnm}} > {{path/to/output.pnm}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PARAMETERS** (2 subsections)\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pnmremap",
        "section": "",
        "mode": "man",
        "summary": "pnmremap - replace colors in a PPM image with colors from another set",
        "synopsis": "pnmremap  [-floyd|-fs|-nfloyd|-nofs]  [-firstisdefault] [-verbose] [-mapfile=mapfile] [-miss-\ningcolor=color] [pnmfile]\nAll options can be abbreviated to their shortest unique prefix.  You may use two hyphens  in-\nstead  of  one  to designate an option.  You may use either white space or an equals sign be-\ntween an option name and its value.",
        "tldr_summary": "Replace the colors in a PNM image.",
        "tldr_examples": [
            {
                "description": "Replace the colors in an image with those in the specified color palette",
                "command": "pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Use Floyd-Steinberg dithering for representing colors missing in the color palette",
                "command": "pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{-fs|-floyd}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Use the first color in the palette for representing colors missing in the color palette",
                "command": "pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{-fi|-firstisdefault}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Use the specified color for representing colors missing in the color palette",
                "command": "pnmremap {{-ma|-mapfile}} {{path/to/palette_file.ppm}} {{-m|-missingcolor}} {{color}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "pnmcolormap",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmcolormap/1/json"
            },
            {
                "name": "ppmcolors",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppmcolors/1/json"
            },
            {
                "name": "pnmquant",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmquant/1/json"
            },
            {
                "name": "ppmquantall",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppmquantall/1/json"
            },
            {
                "name": "pnmdepth",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmdepth/1/json"
            },
            {
                "name": "ppmdither",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppmdither/1/json"
            },
            {
                "name": "mquant",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/mquant/1/json"
            },
            {
                "name": "ppm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/ppm/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 17,
                "subsections": [
                    {
                        "name": "-firstisdefault",
                        "lines": 17
                    },
                    {
                        "name": "-verbose",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pnmremap - replace colors in a PPM image with colors from another set\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pnmremap  [-floyd|-fs|-nfloyd|-nofs]  [-firstisdefault] [-verbose] [-mapfile=mapfile] [-miss-\ningcolor=color] [pnmfile]\n\nAll options can be abbreviated to their shortest unique prefix.  You may use two hyphens  in-\nstead  of  one  to designate an option.  You may use either white space or an equals sign be-\ntween an option name and its value.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "pnmremap replaces the colors in an input image with those from a colormap you specify.  Where\na  color  in  the input is not in the colormap, you have three choices: 1) choose the closest\ncolor from the colormap; 2) choose the first color from the colormap; 3) use a  color  speci-\nfied  by  a  command  option.   (In this latter case, if the color you specify is not in your\ncolor map, the output will not necessarily contain only colors from the colormap).\n\nTwo reasons to do this are: 1) you want to reduce the number of colors in  the  input  image;\nand 2) you need to feed the image to something that can handle only certain colors.\n\nTo reduce colors, you can generate the colormap with ppmcolormap.  Example:\n\nppmcolormap testimg.ppm 256 >colormap.ppm\nppmremap -map=colormap.ppm testimg.ppm\n>reducedtestimg.ppm\n\nTo  limit colors to a certain set, a typical example is to create an image for posting on the\nWorld Wide Web, where different browsers know different colors.  But all  browsers  are  sup-\nposed  to  know the 216 \"web safe\" colors which are essentially all the colors you can repre-\nsent in a PPM image with a maxval of 5.  So you can do this:\n\nppmcolors 5 >websafe.ppm\nppmremap -map=webafe.ppm testimg.ppm >websafetestimg.ppm\n\nThe output image has the same type and maxval as the map file.\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "There is one parameter, which is required:  The file specifcation of the input PNM file.\n\nOPTIONS\n\n-floyd -fs -nofloyd -nofs These options determine whether Floyd-Steinberg dithering is  done.\nWithout  Floyd-Steinberg,  the  selection  of  output color of a pixel is based on the\ncolor of only the corresponding input pixel.   With  Floyd-Steinberg,  multiple  input\npixels are considered so that the average color of an area tends to stay more the same\nthan without Floyd-Steinberg.  For example, if you map an image with  a  black,  gray,\ngray,  and  white pixel adjacent, through a map that contains only black and white, it\nmight result in an output of black, black, white, white.  Pixel-by-pixel mapping would\ninstead map both the gray pixels to the same color.\n\n-fs is a synomym for -floyd.  -nofs is a synonym for -nofloyd.\n\nThe default is -nofloyd.\n",
                "subsections": [
                    {
                        "name": "-firstisdefault",
                        "content": "This  affects  what  happens with a pixel in the input image whose color is not in the\nmap file.  If you specify neither -firstisdefault nor -missingcolor, pnmremap  chooses\nfor  the output the color in the map which is closest to the color in the input.  With\n-firstisdefault, pnmremap instead uses the first color in the colormap.\n\nIf you specify -firstisdefault, the maxval of your input must match the maxval of your\ncolormap.\n\n-missingcolor=color\nThis  affects  what  happens with a pixel in the input image whose color is not in the\nmap file.  If you specify neither -firstisdefault nor -missingcolor, pnmremap  chooses\nfor  the output the color in the map which is closest to the color in the input.  With\n-missingcolor, pnmremap uses color.  color need not be in the colormap.\n\nIf you specify -missingcolor, the maxval of your input must match the maxval  of  your\ncolormap.\n"
                    },
                    {
                        "name": "-verbose",
                        "content": "Display helpful messages about the mapping process.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "pnmcolormap(1),  ppmcolors(1),  pnmquant(1),  ppmquantall(1),  pnmdepth(1), ppmdither(1), pp-\nmquant(1), ppm(5)\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Copyright (C) 1989, 1991 by Jef Poskanzer.  Copyright (C) 2001 by Bryan Henderson.\n\n01 January 2002                              pnmremap(1)",
                "subsections": []
            }
        }
    }
}