{
    "content": [
        {
            "type": "text",
            "text": "# pnmconvol (man)\n\n## NAME\n\npnmconvol - general MxN convolution on a portable anymap\n\n## SYNOPSIS\n\npnmconvol convolutionfile [pnmfile]\n\n## DESCRIPTION\n\nReads two portable anymaps as input.  Convolves the second using the first, and writes a por‐\ntable anymap as output.\n\n## TLDR\n\n> Convolute a PNM image.\n\n- Convolve a PNM image with the specified convolution matrix:\n  `pnmconvol -matrix=-1,3,-1 {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n- Convolve a PNM image with the convolution matrix in the specified files, one for each layer in the input image:\n  `pnmconvol -matrixfile {{path/to/matrix1,path/to/matrix2,...}} {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n- Convolve a PNM image with the convolution matrix in the specified PNM file:\n  `pnmconvol {{path/to/matrix.pnm}} {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n- Normalize the weights in the convolution matrix such that they add up to one:\n  `pnmconvol -matrix=-1,3,-1 -normalize {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **SEE ALSO**\n- **AUTHORS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pnmconvol",
        "section": "",
        "mode": "man",
        "summary": "pnmconvol - general MxN convolution on a portable anymap",
        "synopsis": "pnmconvol convolutionfile [pnmfile]",
        "tldr_summary": "Convolute a PNM image.",
        "tldr_examples": [
            {
                "description": "Convolve a PNM image with the specified convolution matrix",
                "command": "pnmconvol -matrix=-1,3,-1 {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Convolve a PNM image with the convolution matrix in the specified files, one for each layer in the input image",
                "command": "pnmconvol -matrixfile {{path/to/matrix1,path/to/matrix2,...}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Convolve a PNM image with the convolution matrix in the specified PNM file",
                "command": "pnmconvol {{path/to/matrix.pnm}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Normalize the weights in the convolution matrix such that they add up to one",
                "command": "pnmconvol -matrix=-1,3,-1 -normalize {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "pnmsmooth",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmsmooth/1/json"
            },
            {
                "name": "pnm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pnmconvol - general MxN convolution on a portable anymap\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pnmconvol convolutionfile [pnmfile]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Reads two portable anymaps as input.  Convolves the second using the first, and writes a por‐\ntable anymap as output.\n\nConvolution means replacing each pixel with a weighted average of  the  nearby  pixels.   The\nweights  and the area to average are determined by the convolution matrix.  The unsigned num‐\nbers in the convolution file are offset by -maxval/2 to make signed numbers, and then normal‐\nized, so the actual values in the convolution file are only relative.\n\nHere  is a sample convolution file; it does a simple average of the nine immediate neighbors,\nresulting in a smoothed image:\nP2\n3 3\n18\n10 10 10\n10 10 10\n10 10 10\n\nTo see how this works, do the above-mentioned offset: 10 - 18/2 gives 1.  The possible  range\nof values is from 0 to 18, and after the offset that's -9 to 9.  The normalization step makes\nthe range -1 to 1, and the values get scaled correspondingly so they  become  1/9  -  exactly\nwhat  you  want.   The equivalent matrix for 5x5 smoothing would have maxval 50 and be filled\nwith 26.\n\nThe convolution file will usually be a graymap, so that the same convolution gets applied  to\neach color component.  However, if you want to use a pixmap and do a different convolution to\ndifferent colors, you can certainly do that.\n\nAt the edges of the convolved image, where the convolution matrix would extend over the  edge\nof the image, pnmconvol just copies the input pixels directly to the output.\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "pnmsmooth(1), pnm(5)\n\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Copyright (C) 1989, 1991 by Jef Poskanzer.\nModified 26 November 1994 by Mike Burns, burns@chem.psu.edu\n\n\n\n26 November 1994                              pnmconvol(1)",
                "subsections": []
            }
        }
    }
}