PAMMASKSHARPEN(1)
π pammasksharpen β the girlies' guide (General Commands Manual, section 1) β¨
okay bestie, sit DOWN, because this one is a keeper. it's pammasksharpen from the Netpbm fam, and it's about to make your edges pop. π«Ά
π NAME π
pammasksharpen β sharpen an image via an unsharp mask. no cap.
β¨ SYNOPSIS β¨
pammasksharpen [-sharpness=realnum] [-threshold=realnum] maskfile
[inputfile]
the way that literally every option here can be shortened to whatever shortest unique prefix still makes sense? iconic. π you may also use two hyphens instead of one (so like, your choice), and you can separate an option name from its value with plain old white space instead of an equals sign if that's more your vibe.
π EXAMPLES π
here's the whole glowing routine, fr fr:
pamgauss 5 5 -sigma=.7 -tupletype=GRAYSCALE | pamtopnm > gauss.pgm
pnmconvol -nooffset gauss.pgm myimage.ppm > blurred.ppm
pammasksharpen blurred.ppm myimage.ppm > sharpened.ppm
blur it, then un-blur-sharpen it. it's giving β¨glow upβ¨.
π¦ DESCRIPTION π¦
so this program is part of Netpbm(1), and here's the tea: pammasksharpen reads a Netpbm image as its input and hands you back a sharpened version of it, in the same format, as output. it does this via an unsharp mask, which you supply as another Netpbm image. yes, you're bringing your own mask to the party.
an unsharp mask is generally just a blurred version of the original image. and the sharpening math? bestie, it's so simple it hurts:
calculate the "edgeness" of a sample in the input image as the signed difference between the sample value and the corresponding sample in the unsharp mask. that tells you how different the pixel is from its neighbors. then add a multiple of that edgeness to the original sample to get the corresponding output sample. clip as necessary. π
what's the outcome? pixels that are brighter than their neighbors get even brighter, while pixels that are dimmer than their neighbors get even dimmer. so edges β the places where pixel values change quickly in space β stand out more. main character energy, honestly.
β οΈ heads up: the unsharp mask must be the same dimensions and have the same maxval as the input image. no mismatched energy allowed.
πΈ The Unsharp Mask πΈ
you usually create the unsharp mask as a Gaussian blur of the original image, which you can do using pamgauss and pnmconvol as in the example above. the convolution kernel you use with pnmconvol is normally a square with side length an odd number of pixels. odd. always odd. quirky of it. π
when you create an unsharp mask like this, you will have to choose the side length of the convolution kernel. that length implements the parameter of unsharp mask sharpening usually known as "radius". in particular, a radius of R pixels corresponds to a convolution kernel 2R+1 pixels on a side.
radius is a very important parameter β lowkey you can ruin an image with a radius too large. π you can safely use the highest radius with an inanimate object, while a human face demands the least. landscapes fall in between. but it really depends on the size of the details. fine detail needs a smaller radius, or else you may obliterate tiny detail of the same size as the Radius width. a large image often has larger detail (more pixels involved), so it can use a larger radius. radius and sharpness (see the -sharpness option) interact: reducing one allows you to increase the other. it's a whole balance thing. π§
π OPTIONS π
so in addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options β go check that out, it's not optional reading, it's just not listed here), pammasksharpen recognizes the following command line options:
-sharpness=realnumβ this specifies the magnitude of the sharpening. it is the multiple of edgeness that gets added to each sample as described above. β realnum is a nonnegative real decimal number. zero means no sharpening at all. this parameter is known as "amount" in ImageMagick. the default is 1.0. β¨ this option was new in Netpbm 10.30 (October 2005). before that, the sharpness was always 1.0.-threshold=realnumβ this is the minimum amount of edgeness that will be considered edgeness at all. i.e. if the magnitude of the edgeness is less than this,pammasksharpenwill treat the edgeness as zero. a nonzero value may be necessary here to avoid speckling in smooth areas. π this is a fraction of the maxval (so it is in the range [0, 1.0]). the default is 0. this option was new in Netpbm 10.34 (June 2006).
π SEE ALSO π
pnmconvol(1), pamedge(1), pamsharpness(1), pamsharpmap(1), pamarith(1), pnm(1), pam(1)
go read them too, they're all in the group chat.
π HISTORY π
pammasksharpen was new in Netpbm 10.23 (July 2004). a legend from birth, tbh. π
π₯ DOCUMENT SOURCE π₯
this manual page was generated by the Netpbm tool makeman from HTML source. the master documentation is at:
http://netpbm.sourceforge.net/doc/pammasksharpen.html
okay and that's the whole thing!! π this was netpbm documentation, dated 14 June 2006, and we were all in the Pammasksha...ser Manual(1) section together. slay, sharpen, stay gorgeous. πβ¨π¦π
π¦ where this page comes from
- debian bookworm: netpbm 2:11.01.00-2 Β· MIT
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu noble: netpbm 2:11.05.02-1.1build1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms