{
    "mode": "man",
    "parameter": "pgmkernel",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/pgmkernel/1/json",
    "generated": "2026-10-21T13:22:15Z",
    "synopsis": "pgmkernel [-weight=number] [-maxval=] {size | width height}\nMinimum  unique  abbreviation of option is acceptable.  You may use double hyphens instead of\nsingle hyphen to denote options.  You may use white space in place of the equals sign to sep‐\narate an option name from its value.",
    "sections": {
        "NAME": {
            "content": "pgmkernel - generate a convolution kernel\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pgmkernel [-weight=number] [-maxval=] {size | width height}\n\nMinimum  unique  abbreviation of option is acceptable.  You may use double hyphens instead of\nsingle hyphen to denote options.  You may use white space in place of the equals sign to sep‐\narate an option name from its value.\n\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\npgmkernel generates a convolution kernel that you can use with pnmconvol.  The kernel is  one\nwhere  the  weight of each location is inversely proportional to its distance from the center\nof the kernel.\n\npgmkernel generates a PGM image of width and height size if  you  specify  one  argument,  or\nwidth width and height height if you specify two arguments.\n\npgmkernel computes the convolution function K as follows.\n\nK(i,j) = 1 / ( 1 + w * sqrt(i^2 + j^2))\n\nwhere  w  is a coefficient specified via the -weight option.  i and j are measured in pixels.\nK is zero everywhere beyond the specified kernel width and height.\n\nThe sample values in the PGM output have this value scaled and biased using the protocol pnm‐\nconvol specifies for representing the real numbers K in PGM.\n\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "In addition to the options common to all programs based on libnetpbm  (most  notably  -quiet,\nsee  Common Options ), pgmkernel recognizes the following command line options:\n\n\n",
            "subsections": [
                {
                    "name": "-weight=_",
                    "content": "The  distance  from  the  center  is weighted by this; a higher number means the value\nfalls off more quickly as you go away from the center.\n\nThis must be a positive real number.\n\nThe default is 6.0.\n\n"
                },
                {
                    "name": "-maxval=_",
                    "content": "The maxval for the PGM kernel.\n\nDefault is 255.\n\nThis option was new in Netpbm 10.65 (December 2013).  Before that, the maxval  is  al‐\nways 255.\n\n\n\n\n"
                }
            ]
        },
        "LIMITATIONS": {
            "content": "The  computation  time  is proportional to width*height.  This increases rapidly with the in‐\ncrease of the kernel size.  A better approach could be using a FFT in these cases.\n\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "Before Netpbm 10.65 (December 2013), the output was always in Plain (text) PGM format.  (Now,\nlike standard Netpbm programs, the default is raw PGM and you can get Plain PGM with a -plain\noption).\n\nBefore Netpbm 10.65 (December 2013), this manual said negative values for -weight were  valid\n(as long as they were greater than -1.0).  But the program never worked with negative numbers\nand it isn't clear that the result would be useful, so -weight is now required to be nonnega‐\ntive and the program fails gracefully if you specify a negative value.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pnmconvol(1), pnmsmooth(1) pamgauss(1) pgm(1)\n\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Alberto Accomazzi (alberto@cfa.harvard.edu).\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/pgmkernel.html\n\nnetpbm documentation                      19 December 2013                  Pgmkernel User Manual(1)",
            "subsections": []
        }
    },
    "summary": "pgmkernel - generate a convolution kernel",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The distance from the center is weighted by this; a higher number means the value falls off more quickly as you go away from the center. This must be a positive real number. The default is 6.0."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The maxval for the PGM kernel. Default is 255. This option was new in Netpbm 10.65 (December 2013). Before that, the maxval is al‐ ways 255."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pnmconvol",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmconvol/1/json"
        },
        {
            "name": "pnmsmooth",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmsmooth/1/json"
        },
        {
            "name": "pamgauss",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamgauss/1/json"
        },
        {
            "name": "pgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Generate a convolution kernel to be used with `pnmconvol`.",
        "examples": [
            {
                "description": "Generate a convolution kernel",
                "command": "pgmkernel {{width}} {{height}} > {{path/to/output.pgm}}"
            },
            {
                "description": "Generate a quadratic convolution kernel",
                "command": "pgmkernel {{size}} > {{path/to/output.pgm}}"
            },
            {
                "description": "Specify the weight of the center in the generated kernel",
                "command": "pgmkernel {{-w|-weight}} {{value}} {{width}} {{height}} > {{path/to/output.pgm}}"
            }
        ]
    }
}