| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> |
| 2 |
<html><head><title>Pbmnoise User Manual</title></head> |
| 3 |
<body> |
| 4 |
<h1>pbmnoise</h1> |
| 5 |
Updated: 18 December 2021 |
| 6 |
<br> |
| 7 |
<a href="#index">Table Of Contents</a> |
| 8 |
|
| 9 |
<h2>NAME</h2> |
| 10 |
pbmnoise - create a PBM image made up of white noise |
| 11 |
|
| 12 |
<h2 id="synopsis">SYNOPSIS</h2> |
| 13 |
|
| 14 |
<b>pbmnoise</b> <i>width</i> <i>height</i> |
| 15 |
|
| 16 |
[<b>-ratio=</b><i>M</i><b>/</b><i>N</i>] |
| 17 |
[<b>-pack</b>] |
| 18 |
[<b>-randomseed=</b><i>integer</i>] |
| 19 |
[<b>-endian=</b>]{<b>big</b>|<b>little</b>|<b>native</b>|<b>swap</b>}] |
| 20 |
|
| 21 |
<p>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 |
<h2 id="description">DESCRIPTION</h2> |
| 26 |
|
| 27 |
<p>This program is part of <a href="index.html">Netpbm</a>. |
| 28 |
|
| 29 |
<p><b>pbmnoise</b> creates a PBM image with random pixels. You specify the |
| 30 |
probability each pixel will be black or white (essentially, the proportion of |
| 31 |
black to white pixels in the image). |
| 32 |
|
| 33 |
<p>You specify the dimensions of the image with the <i>width</i> and |
| 34 |
<i>height</i> arguments. |
| 35 |
|
| 36 |
|
| 37 |
<h2 id="options">OPTIONS</h2> |
| 38 |
|
| 39 |
<p>In addition to the options common to all programs based on libnetpbm (most |
| 40 |
notably <b>-quiet</b>, see <a href="index.html#commonoptions"> Common |
| 41 |
Options</a>), <b>pbmnoise</b> recognizes the following command line options: |
| 42 |
|
| 43 |
<dl> |
| 44 |
<dt><b>-ratio=</b><i>M</i><b>/</b><i>N</i> |
| 45 |
<dd>The proportion of black pixels in the generated image. |
| 46 |
|
| 47 |
<p>To be precise, this is the probability that any given pixel will be black. |
| 48 |
By the law of large numbers, we can expect the proportion of black pixels in a |
| 49 |
reasonably large image to be close to this fraction. |
| 50 |
|
| 51 |
<p>The option value is a fraction. The denominator must be 1 or an integer |
| 52 |
power of 2 up to 65536. the numerator must be 0 or a positive integer not |
| 53 |
exceeding denominator. |
| 54 |
|
| 55 |
<p>The default is 1/2, meaning the output image has essentially the same |
| 56 |
number of black and white pixels. |
| 57 |
|
| 58 |
<p>If the ratio is 0 the output image is entirely white. If 1, the output is |
| 59 |
entirely black. |
| 60 |
|
| 61 |
<dt><b>-pack</b> |
| 62 |
<dd> |
| 63 |
The program generates pixels in 32-bit units discarding any fractional pixels |
| 64 |
at row ends by default. When this option is specified, the unused pixels are |
| 65 |
carried over to the next row, eliminating waste in exchange for some overhead |
| 66 |
cost. |
| 67 |
|
| 68 |
<p>Using this option improves performance when the image width is small. |
| 69 |
|
| 70 |
<dt><b>-randomseed=</b><i>integer</i> |
| 71 |
<dd> |
| 72 |
This is the seed for the random number generator that generates the pixels. |
| 73 |
|
| 74 |
<p>Use this to ensure you get the same image on separate invocations. |
| 75 |
|
| 76 |
<p>By default, <b>pbmnoise</b> uses a seed derived from the time of day and |
| 77 |
process ID, which gives you fairly uncorrelated results in multiple |
| 78 |
invocations. |
| 79 |
|
| 80 |
<dt><b>-endian=</b><i>mode</i> |
| 81 |
<dd> |
| 82 |
<b>pbmnoise</b> internally generates random 32-bit integers and uses the |
| 83 |
machine's binary encoding of those integers as strings of pixels. Because the |
| 84 |
integers are random, it doesn't normally matter what binaary encoding is used |
| 85 |
for them, but if you need consistent results between machines using the same |
| 86 |
random number generator, it matters. For that reason (mainly for testing the |
| 87 |
program), this option lets you control that encoding, between big-endian and |
| 88 |
little-endian. |
| 89 |
|
| 90 |
<p><i>mode</i> is one of the following: |
| 91 |
|
| 92 |
<dl compact> |
| 93 |
<dt><b>big</b> |
| 94 |
<dd> |
| 95 |
Force big-endian output by rearranging bytes on little-endian machines. No |
| 96 |
effect on big-endian machines. |
| 97 |
|
| 98 |
<dt><b>little</b> |
| 99 |
<dd> |
| 100 |
Likewise, force little-endian output. |
| 101 |
|
| 102 |
<dt><b>native</b> |
| 103 |
|
| 104 |
<dd> |
| 105 |
Do not rearrange anything. This is the default. |
| 106 |
|
| 107 |
<dt><b>swap</b> |
| 108 |
<dd> |
| 109 |
Always swap regardless of system endianness. |
| 110 |
</dl> |
| 111 |
</dl> |
| 112 |
|
| 113 |
|
| 114 |
<h2 id="examples">EXAMPLES</h2> |
| 115 |
|
| 116 |
<p>This generates a random PBM image with roughly one-third of pixels colored |
| 117 |
black: |
| 118 |
<pre><code> |
| 119 |
pbmnoise -ratio=11/32 1200 1200 > random.pbm |
| 120 |
</code></pre> |
| 121 |
|
| 122 |
<p>The following is an alternate method for generating a random PBM image |
| 123 |
which uses <b>pgmnoise</b> and <b>pgmtopbm</b> instead of <b>pbmnoise</b>. It |
| 124 |
is less efficient. |
| 125 |
<pre><code> |
| 126 |
pgmnoise -maxval=100 1200 1200 | \ |
| 127 |
pgmtopbm -threshold -value=0.333 > random.pbm |
| 128 |
</code></pre> |
| 129 |
|
| 130 |
<p>This generates a random PPM image, maxval 1: |
| 131 |
<pre><code> |
| 132 |
pbmnoise 600 400 > red.pbm |
| 133 |
pbmnoise 600 400 > green.pbm |
| 134 |
pbmnoise 600 400 > blue.pbm |
| 135 |
rgb3topbm red.pbm green.pbm blue.pbm > random.ppm |
| 136 |
</code></pre> |
| 137 |
|
| 138 |
|
| 139 |
<h2 id="seealso">SEE ALSO</h2> |
| 140 |
|
| 141 |
<a href="pbm.html">pbm</a> |
| 142 |
<a href="pgmnoise.html">pgmnoise</a> |
| 143 |
<a href="pgmnoise.html">pgmtopbm</a> |
| 144 |
|
| 145 |
<h2 id="history">HISTORY</h2> |
| 146 |
|
| 147 |
<p><b>pbmnoise</b> was new in Netpbm 10.97 (December 2021). |
| 148 |
|
| 149 |
<p>In Netpbm before that, you can use <b>pgmnoise</b>. |
| 150 |
|
| 151 |
|
| 152 |
<h2 id="author">AUTHOR</h2> |
| 153 |
<p> |
| 154 |
Akira F Urushibata wrote this program and contributed it to the public domain |
| 155 |
in December 2021. |
| 156 |
|
| 157 |
<hr> |
| 158 |
<h2 id="index">Table Of Contents</h2> |
| 159 |
<ul> |
| 160 |
<li><a href="#synopsis">SYNOPSIS</a> |
| 161 |
<li><a href="#description">DESCRIPTION</a> |
| 162 |
<li><a href="#options">OPTIONS</a> |
| 163 |
<li><a href="#examples">EXAMPLES</a> |
| 164 |
<li><a href="#seealso">SEE ALSO</a> |
| 165 |
<li><a href="#author">AUTHOR</a> |
| 166 |
</ul> |
| 167 |
</body> |
| 168 |
</html> |