dwww Home | Manual pages | Find package

Pbmnoise User Manual(1)     General Commands Manual     Pbmnoise User Manual(1)

NAME
       pbmnoise - create a PBM image made up of white noise

SYNOPSIS
       pbmnoise width height

       [-ratio=M/N]   [-pack]  [-randomseed=integer]  [-endian=]{big|little|na-
       tive|swap}]

       Minimum unique abbreviations of option are acceptable.  You may use dou-
       ble hyphens instead of single hyphen to denote  options.   You  may  use
       white  space in place of the equals sign to separate an option name from
       its value.

DESCRIPTION
       This program is part of Netpbm(1).

       pbmnoise creates a PBM image with random pixels.  You specify the proba-
       bility each pixel will be black or white (essentially, the proportion of
       black to white pixels in the image).

       You specify the dimensions of the image with the width and height  argu-
       ments.

OPTIONS
       In  addition  to  the  options common to all programs based on libnetpbm
       (most notably -quiet, see ]8;;index.html#commonoptions\ Common Options]8;;\  ),  pbmnoise  recognizes  the
       following command line options:

       -ratio=M/N
              The proportion of black pixels in the generated image.

              To  be precise, this is the probability that any given pixel will
              be black.  By the law of large numbers, we can expect the propor-
              tion of black pixels in a reasonably large image to be  close  to
              this fraction.

              The  option value is a fraction.  The denominator must be 1 or an
              integer power of 2 up to 65536.  the numerator must  be  0  or  a
              positive integer not exceeding denominator.

              The  default is 1/2, meaning the output image has essentially the
              same number of black and white pixels.

              If the ratio is 0 the output image is entirely white.  If 1,  the
              output is entirely black.

       -pack  The program generates pixels in 32-bit units discarding any frac-
              tional pixels at row ends by default.  When this option is speci-
              fied,  the unused pixels are carried over to the next row, elimi-
              nating waste in exchange for some overhead cost.

              Using this option improves performance when the  image  width  is
              small.

       -randomseed=integer
              This  is  the seed for the random number generator that generates
              the pixels.

              Use this to ensure you get the same  image  on  separate  invoca-
              tions.

              By default, pbmnoise uses a seed derived from the time of day and
              process ID, which gives you fairly uncorrelated results in multi-
              ple invocations.

       -endian=mode
              pbmnoise internally generates random 32-bit integers and uses the
              machine's binary encoding of those integers as strings of pixels.
              Because  the integers are random, it doesn't normally matter what
              binaary encoding is used for them, but if you need consistent re-
              sults between machines using the same random number generator, it
              matters.  For that reason (mainly for testing the program),  this
              option  lets  you  control  that encoding, between big-endian and
              little-endian.

              mode is one of the following:

       big    Force big-endian output by rearranging bytes on little-endian ma-
              chines.  No effect on big-endian machines.

       little Likewise, force little-endian output.

       native Do not rearrange anything.  This is the default.

       swap   Always swap regardless of system endianness.

EXAMPLES
       This generates a random PBM image with roughly one-third of pixels  col-
       ored black:
         pbmnoise -ratio=11/32 1200 1200 > random.pbm

       The  following  is an alternate method for generating a random PBM image
       which uses pgmnoise and pgmtopbm instead of pbmnoise.  It is less  effi-
       cient.
         pgmnoise -maxval=100 1200 1200 | \
           pgmtopbm -threshold -value=0.333 > random.pbm

       This generates a random PPM image, maxval 1:
         pbmnoise 600 400 > red.pbm
         pbmnoise 600 400 > green.pbm
         pbmnoise 600 400 > blue.pbm
         rgb3topbm red.pbm green.pbm blue.pbm > random.ppm

SEE ALSO
       pbm(1) pgmnoise(1) pgmtopbm(1)

HISTORY
       pbmnoise was new in Netpbm 10.97 (December 2021).

       In Netpbm before that, you can use pgmnoise.

AUTHOR
       Akira  F  Urushibata wrote this program and contributed it to the public
       domain in December 2021.

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/pbmnoise.html

netpbm documentation            18 December 2021        Pbmnoise User Manual(1)

Generated by dwww version 1.16 on Thu Dec 11 13:40:59 CET 2025.