# man > pgmkernel(1)

> **TLDR:** Generate a convolution kernel to be used with `pnmconvol`.
>
- Generate a convolution kernel:
  `pgmkernel {{width}} {{height}} > {{path/to/output.pgm}}`
- Generate a quadratic convolution kernel:
  `pgmkernel {{size}} > {{path/to/output.pgm}}`
- Specify the weight of the center in the generated kernel:
  `pgmkernel {{-w|-weight}} {{value}} {{width}} {{height}} > {{path/to/output.pgm}}`

*Source: tldr-pages*

---

[pgmkernel(1)](https://www.chedong.com/phpMan.php/man/pgmkernel/1/markdown)                           General Commands Manual                          [pgmkernel(1)](https://www.chedong.com/phpMan.php/man/pgmkernel/1/markdown)



## NAME
       pgmkernel - generate a convolution kernel

## SYNOPSIS
       **pgmkernel** [ **-weight** _w_ ] _width_ [ _height_ ]

## DESCRIPTION
       Generates  a portable graymap array of size _width_ x _height_ (or _width_ x _width_ if _height_ is not
       specified) to be used as a convolution file by **pnmconvol**.  The data in the convolution  array
       K are computed according to the formula:

       K(i,j) = 1 / ( 1 + w * sqrt((i-width/2)^2 + (j-height/2)^2))

       where _w_ is a coefficient specified via the _-weight_ flag, and _width_ and _height_ are the X and Y
       filter sizes.

       The output PGM file is always written out in ASCII format.

## OPTIONS
       The optional _-weight_ flag should be a real number greater than -1.  The default value is 6.0.

## BUGS
       The computation time is proportional to _width_ * _height_.  This increases rapidly with the  in‐
       crease of the kernel size.  A better approach could be using a FFT in these cases.

## SEE ALSO
       [pnmconvol(1)](https://www.chedong.com/phpMan.php/man/pnmconvol/1/markdown), [pnmsmooth(1)](https://www.chedong.com/phpMan.php/man/pnmsmooth/1/markdown)

## AUTHOR
       Alberto Accomazzi (<alberto@cfa.harvard.edu>).




                                          10 December 1992                              [pgmkernel(1)](https://www.chedong.com/phpMan.php/man/pgmkernel/1/markdown)
