| 1 |
\ |
| 2 |
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. |
| 3 |
.\" Do not hand-hack it! If you have bug fixes or improvements, please find |
| 4 |
.\" the corresponding HTML page on the Netpbm website, generate a patch |
| 5 |
.\" against that, and send it to the Netpbm maintainer. |
| 6 |
.TH "Pbmnoise User Manual" 1 "18 December 2021" "netpbm documentation" |
| 7 |
|
| 8 |
.SH NAME |
| 9 |
pbmnoise - create a PBM image made up of white noise |
| 10 |
|
| 11 |
.UN synopsis |
| 12 |
.SH SYNOPSIS |
| 13 |
|
| 14 |
\fBpbmnoise\fP \fIwidth\fP \fIheight\fP |
| 15 |
|
| 16 |
[\fB-ratio=\fP\fIM\fP\fB/\fP\fIN\fP] |
| 17 |
[\fB-pack\fP] |
| 18 |
[\fB-randomseed=\fP\fIinteger\fP] |
| 19 |
[\fB-endian=\fP]{\fBbig\fP|\fBlittle\fP|\fBnative\fP|\fBswap\fP}] |
| 20 |
.PP |
| 21 |
Minimum unique abbreviations of option are acceptable. You may use double |
| 22 |
hyphens instead of single hyphen to denote options. You may use white space |
| 23 |
in place of the equals sign to separate an option name from its value. |
| 24 |
|
| 25 |
.UN description |
| 26 |
.SH DESCRIPTION |
| 27 |
.PP |
| 28 |
This program is part of |
| 29 |
.BR "Netpbm" (1)\c |
| 30 |
\&. |
| 31 |
.PP |
| 32 |
\fBpbmnoise\fP creates a PBM image with random pixels. You specify the |
| 33 |
probability each pixel will be black or white (essentially, the proportion of |
| 34 |
black to white pixels in the image). |
| 35 |
.PP |
| 36 |
You specify the dimensions of the image with the \fIwidth\fP and |
| 37 |
\fIheight\fP arguments. |
| 38 |
|
| 39 |
|
| 40 |
.UN options |
| 41 |
.SH OPTIONS |
| 42 |
.PP |
| 43 |
In addition to the options common to all programs based on libnetpbm (most |
| 44 |
notably \fB-quiet\fP, see |
| 45 |
.UR index.html#commonoptions |
| 46 |
Common Options |
| 47 |
.UE |
| 48 |
\&), \fBpbmnoise\fP recognizes the following command line options: |
| 49 |
|
| 50 |
|
| 51 |
.TP |
| 52 |
\fB-ratio=\fP\fIM\fP\fB/\fP\fIN\fP |
| 53 |
The proportion of black pixels in the generated image. |
| 54 |
.sp |
| 55 |
To be precise, this is the probability that any given pixel will be black. |
| 56 |
By the law of large numbers, we can expect the proportion of black pixels in a |
| 57 |
reasonably large image to be close to this fraction. |
| 58 |
.sp |
| 59 |
The option value is a fraction. The denominator must be 1 or an integer |
| 60 |
power of 2 up to 65536. the numerator must be 0 or a positive integer not |
| 61 |
exceeding denominator. |
| 62 |
.sp |
| 63 |
The default is 1/2, meaning the output image has essentially the same |
| 64 |
number of black and white pixels. |
| 65 |
.sp |
| 66 |
If the ratio is 0 the output image is entirely white. If 1, the output is |
| 67 |
entirely black. |
| 68 |
|
| 69 |
.TP |
| 70 |
\fB-pack\fP |
| 71 |
The program generates pixels in 32-bit units discarding any fractional pixels |
| 72 |
at row ends by default. When this option is specified, the unused pixels are |
| 73 |
carried over to the next row, eliminating waste in exchange for some overhead |
| 74 |
cost. |
| 75 |
.sp |
| 76 |
Using this option improves performance when the image width is small. |
| 77 |
|
| 78 |
.TP |
| 79 |
\fB-randomseed=\fP\fIinteger\fP |
| 80 |
This is the seed for the random number generator that generates the pixels. |
| 81 |
.sp |
| 82 |
Use this to ensure you get the same image on separate invocations. |
| 83 |
.sp |
| 84 |
By default, \fBpbmnoise\fP uses a seed derived from the time of day and |
| 85 |
process ID, which gives you fairly uncorrelated results in multiple |
| 86 |
invocations. |
| 87 |
|
| 88 |
.TP |
| 89 |
\fB-endian=\fP\fImode\fP |
| 90 |
\fBpbmnoise\fP internally generates random 32-bit integers and uses the |
| 91 |
machine's binary encoding of those integers as strings of pixels. Because the |
| 92 |
integers are random, it doesn't normally matter what binaary encoding is used |
| 93 |
for them, but if you need consistent results between machines using the same |
| 94 |
random number generator, it matters. For that reason (mainly for testing the |
| 95 |
program), this option lets you control that encoding, between big-endian and |
| 96 |
little-endian. |
| 97 |
.sp |
| 98 |
\fImode\fP is one of the following: |
| 99 |
|
| 100 |
|
| 101 |
.TP |
| 102 |
\fBbig\fP |
| 103 |
Force big-endian output by rearranging bytes on little-endian machines. No |
| 104 |
effect on big-endian machines. |
| 105 |
|
| 106 |
.TP |
| 107 |
\fBlittle\fP |
| 108 |
Likewise, force little-endian output. |
| 109 |
|
| 110 |
.TP |
| 111 |
\fBnative\fP |
| 112 |
Do not rearrange anything. This is the default. |
| 113 |
|
| 114 |
.TP |
| 115 |
\fBswap\fP |
| 116 |
Always swap regardless of system endianness. |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
.UN examples |
| 122 |
.SH EXAMPLES |
| 123 |
.PP |
| 124 |
This generates a random PBM image with roughly one-third of pixels colored |
| 125 |
black: |
| 126 |
.nf\f(CW |
| 127 |
pbmnoise -ratio=11/32 1200 1200 > random.pbm |
| 128 |
\fP |
| 129 |
.fi |
| 130 |
.PP |
| 131 |
The following is an alternate method for generating a random PBM image |
| 132 |
which uses \fBpgmnoise\fP and \fBpgmtopbm\fP instead of \fBpbmnoise\fP. It |
| 133 |
is less efficient. |
| 134 |
.nf\f(CW |
| 135 |
pgmnoise -maxval=100 1200 1200 | \e |
| 136 |
pgmtopbm -threshold -value=0.333 > random.pbm |
| 137 |
\fP |
| 138 |
.fi |
| 139 |
.PP |
| 140 |
This generates a random PPM image, maxval 1: |
| 141 |
.nf\f(CW |
| 142 |
pbmnoise 600 400 > red.pbm |
| 143 |
pbmnoise 600 400 > green.pbm |
| 144 |
pbmnoise 600 400 > blue.pbm |
| 145 |
rgb3topbm red.pbm green.pbm blue.pbm > random.ppm |
| 146 |
\fP |
| 147 |
.fi |
| 148 |
|
| 149 |
|
| 150 |
.UN seealso |
| 151 |
.SH SEE ALSO |
| 152 |
.BR "pbm" (1)\c |
| 153 |
\& |
| 154 |
.BR "pgmnoise" (1)\c |
| 155 |
\& |
| 156 |
.BR "pgmtopbm" (1)\c |
| 157 |
\& |
| 158 |
|
| 159 |
.UN history |
| 160 |
.SH HISTORY |
| 161 |
.PP |
| 162 |
\fBpbmnoise\fP was new in Netpbm 10.97 (December 2021). |
| 163 |
.PP |
| 164 |
In Netpbm before that, you can use \fBpgmnoise\fP. |
| 165 |
|
| 166 |
|
| 167 |
.UN author |
| 168 |
.SH AUTHOR |
| 169 |
.PP |
| 170 |
Akira F Urushibata wrote this program and contributed it to the public domain |
| 171 |
in December 2021. |
| 172 |
.SH DOCUMENT SOURCE |
| 173 |
This manual page was generated by the Netpbm tool 'makeman' from HTML |
| 174 |
source. The master documentation is at |
| 175 |
.IP |
| 176 |
.B http://netpbm.sourceforge.net/doc/pbmnoise.html |
| 177 |
.PP |