Minimum unique abbreviations of options are acceptable. You may use double hyphens instead of a single hyphen to denote options. You may use white space in place of the equals sign to separate an option name from its value.
This program is part of Netpbm.
pamthreshold thresholds a grayscale image. Thresholding means dividing the image into background and foreground by comparing every pixel to a thresholding value.
The input should be a PGM image or a PAM image of tuple type GRAYSCALE or GRAYSCALE_ALPHA. However, pamthreshold doesn't check; it just thresholds the first channel as if it were grayscale samples and if there is a second channel, processes it as if it is a transparency (alpha) channel. So if you feed it e.g. a PPM image, it will work but produce probably useless results.
The output is a PAM with tuple type BLACKANDWHITE or BLACKANDWHITE_ALPHA, depending on whether the input has a transparency channel. You can turn this into a PBM (if you need to use it with an older program that doesn't understand PAM, or you can't afford the 8X amount of space that PAM uses for the image) with pamtopnm.
The output is to Standard Output.
When the input has a transparency channel, pamthreshold includes a transparency channel in the output. Since the output has maxval 1, the transparency channel can indicate only fully transparent or fully opaque. pamthreshold make it fully transparent where the input is more than half transparent and fully opaque where it isn't.
The transparency function was new in Netpbm 10.43 (June 2008). Before that, pamthreshold ignores any transparency channel in the input.
Another way to convert a grayscale image to black and white is to dither. Dithering is using clustered black and white pixels such that if you step back and look at the picture, you see varying levels of gray. pamditherbw does dithering.
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamthreshold recognizes the following command line options:
Without any options, pamthreshold uses a method based on the iterative algorithm found in the wikipedia article Thresholding (image processing) to compute the thresholding value. (this version of the Wikipedia article was current at the time of this writing). It uses this threshold to globally threshold the image. This should work well for most images. The program issues a message telling you what threshold it used. (Netpbm messages go to Standard Error, and you can turn them off with the Netpbm common option -quiet).
Options -simple, -local, and -dual select other methods.
If you don't specify this option, pamthreshold uses a threshold of 0.5.
Without -simple, -local, or -dual, this option is meaningless.
The meaning of the threshold depends upon the kind of thresholding you do (as determined by other options). Roughly, pixels at least as bright as the threshold become white in the output while others become black.
If you don't specify this option, pamthreshold uses a contrast threshold of 0.05. Without -dual this option is meaningless.
pamthreshold was new in Netpbm 10.34 (June 2006).
pamthreshold is Copyright © 2006 by Erik Auerswald and released under the GPL.