{
    "content": [
        {
            "type": "text",
            "text": "# pnmcolormap (info)\n\n## NAME\n\npnmcolormap - create quantization color map for a portable anymap\n\n## SYNOPSIS\n\npnmcolormap [-center|-meancolor|-meanpixel] [-spreadbrightness|-spread-\nluminosity] [-sort] [-square] ncolors|all [pnmfile]\nAll options can be abbreviated to their shortest  unique  prefix.   You\nmay use two hyphens instead of one to designate an option.  You may use\neither white space or an equals sign between an  option  name  and  its\nvalue.\n\n## DESCRIPTION\n\nReads  a  PNM image as input.  Chooses ncolors colors to best represent\nthe image, maps the existing colors to the new ones, and writes  a  PNM\ncolor map defining them as output.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PARAMETERS** (7 subsections)\n- **QUANTIZATION METHOD**\n- **REFERENCES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pnmcolormap",
        "section": "",
        "mode": "info",
        "summary": "pnmcolormap - create quantization color map for a portable anymap",
        "synopsis": "pnmcolormap [-center|-meancolor|-meanpixel] [-spreadbrightness|-spread-\nluminosity] [-sort] [-square] ncolors|all [pnmfile]\nAll options can be abbreviated to their shortest  unique  prefix.   You\nmay use two hyphens instead of one to designate an option.  You may use\neither white space or an equals sign between an  option  name  and  its\nvalue.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "pnmremap",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmremap/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": "ppmquant",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppmquant/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": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 26,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 13,
                "subsections": [
                    {
                        "name": "-square",
                        "lines": 7
                    },
                    {
                        "name": "-verbose",
                        "lines": 3
                    },
                    {
                        "name": "-center",
                        "lines": 1
                    },
                    {
                        "name": "-meancolor",
                        "lines": 1
                    },
                    {
                        "name": "-meanpixel",
                        "lines": 1
                    },
                    {
                        "name": "-spreadbrightness",
                        "lines": 1
                    },
                    {
                        "name": "-spreadluminosity",
                        "lines": 3
                    }
                ]
            },
            {
                "name": "QUANTIZATION METHOD",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "REFERENCES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pnmcolormap - create quantization color map for a portable anymap\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pnmcolormap [-center|-meancolor|-meanpixel] [-spreadbrightness|-spread-\nluminosity] [-sort] [-square] ncolors|all [pnmfile]\n\nAll options can be abbreviated to their shortest  unique  prefix.   You\nmay use two hyphens instead of one to designate an option.  You may use\neither white space or an equals sign between an  option  name  and  its\nvalue.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Reads  a  PNM image as input.  Chooses ncolors colors to best represent\nthe image, maps the existing colors to the new ones, and writes  a  PNM\ncolor map defining them as output.\n\nYou  can  use  this map as input to pnmremap on the same input image to\nquantize the colors in that image, I.e.  produce a similar  image  with\nfewer  colors.   pnmquant  does both the pnmcolormap and pnmremap steps\nfor you.\n\nA PNM colormap is a PNM image of any dimensions that contains at  least\none pixel of each color in the set of colors it represents.\n\nThe  quantization  method  is Heckbert's \"median cut\".  See the section\nQUANTIZATION METHOD.\n\nIf the input image is a PPM, the output image is a PPM.  If  the  input\nimage  is a PBM or PGM, the output colormap is a PGM.  Note that a col-\normap of a PBM image is not very interesting.\n\nThe colormap generally has the same maxval as the input image, but pnm-\ncolormap  may  reduce  it if there are too many colors in the input, as\npart of its quantization algorithm.\n\nIf you want to create a colormap without basing it on the colors in  an\ninput image, see ppmcolors.\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "The  single  parameter,  which is required, is the number of colors you\nwant in the output colormap.  pnmcolormap may produce a color map  with\nslightly fewer colors than that.  You may specify all to get a colormap\nof every color in the input image (no quantization).\n\nOPTIONS\n\n-sort  This option causes the output colormap to be sorted by  the  red\ncomponent  intensity, then the green, then the blue in ascending\norder.  This is an insertion sort, so it is  not  very  fast  on\nlarge  colormaps.   Sorting  is  useful because it allows you to\ncompare two sets of colors.\n",
                "subsections": [
                    {
                        "name": "-square",
                        "content": "By default, pnmcolormap produces as the color map  a  PPM  image\nwith  one  row  and  one  column for each color in the colormap.\nThis option causes pnmcolormap instead to produce  a  PPM  image\nthat  is within one row or column of being square, with multiple\npixels of the same color as necessary to create a number of pix-\nels which is a perfect square.\n"
                    },
                    {
                        "name": "-verbose",
                        "content": "This  option  causes pnmcolormap to display messages to Standard\nError about the quantization.\n"
                    },
                    {
                        "name": "-center",
                        "content": ""
                    },
                    {
                        "name": "-meancolor",
                        "content": ""
                    },
                    {
                        "name": "-meanpixel",
                        "content": ""
                    },
                    {
                        "name": "-spreadbrightness",
                        "content": ""
                    },
                    {
                        "name": "-spreadluminosity",
                        "content": "These options control the quantization algorithm.  See QUANTIZA-\nTION METHOD below.\n"
                    }
                ]
            },
            "QUANTIZATION METHOD": {
                "content": "A  quantization  method is a way to choose which colors, being fewer in\nnumber than in the input, you want in  the  output.   pnmcolormap  uses\nHeckbert's \"median cut\" quantization method.\n\nThis method involves separating all the colors into \"boxes,\" each hold-\ning colors that represent about the same number of pixels.   You  start\nwith  one  box  and split boxes in two until the number of boxes is the\nsame as the number of colors you want in the  output,  and  choose  one\ncolor to represent each box.\n\nWhen  you  split a box, you do it so that all the colors in one sub-box\nare \"greater\" than all the colors in the other.  \"Greater,\" for a  par-\nticular  box,  means it is brighter in the color component (red, green,\nblue) which has the largest spread in that box.  pnmcolormap gives  you\ntwo ways to define \"largest spread.\":  1) largest spread of brightness;\n2) largest spread of contribution to the luminosity of the color.  E.g.\nred  is  weighted  much  more  than  blue.  Select among these with the\n-spreadbrightness  and  -spreadluminosity  options.   The  default   is\n-spreadbrightness.\n\npnmcut  provides  three ways of choosing a color to represent a box: 1)\nthe center color - the color halfway between  the  greatest  and  least\ncolors in the box, using the above definition of \"greater\"; 2) the mean\nof the colors (each component averaged separately by brightness) in the\nbox; 3) the mean weighted by the number of pixels of a color in the im-\nage.\n\nNote that in all three methods, there may be colors in the output which\ndo not appear in the input at all.\n\nSelect  among  these  with  the -center, -meancolor, and -meanpixel op-\ntions.  The default is -center.\n",
                "subsections": []
            },
            "REFERENCES": {
                "content": "\"Color Image Quantization for Frame Buffer Display\" by  Paul  Heckbert,\nSIGGRAPH '82 Proceedings, page 297.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "pnmremap(1),  pnmquant(1),  ppmquantall(1),  pnmdepth(1), ppmdither(1),\nppmquant(1), ppm(5)\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Copyright (C) 1989, 1991 by Jef Poskanzer.  Copyright (C) 2001 by Bryan\nHenderson.\n\n12 December 2001                 pnmcolormap(1)",
                "subsections": []
            }
        }
    }
}