PBMNOISE(1)

πŸ“¦
version 11.13.03 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Pbmnoise User Manual ✨

okay bestie, come sit with me, because this one is genuinely so fun πŸ’– It's part of the Pbmnoise User Manual, which lives in the General Commands Manual section (section 1, obviously, we're commands). Anyway. Let's go.


🌈 NAME 🌈

pbmnoise β€” create a PBM image made up of white noise πŸŽ€


🌸 SYNOPSIS 🌸

pbmnoise width height

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

ngl, a couple of housekeeping notes that apply to literally every option here:

  • Minimum unique abbreviations of option are acceptable. So yes, you can be lazy, the program gets it. πŸ’…
  • You may use double 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 πŸ’œ

So this program is part of Netpbm(1), our beloved little pixel family 🫢

pbmnoise creates a PBM image with random pixels. That's it. That's the whole vibe. ✨ You tell it the probability that each pixel will be black or white β€” essentially, the proportion of black to white pixels in the image. Main character energy for every single pixel.

And you specify the dimensions of the image with the width and height arguments, bestie. No dimensions, no image, rules are rules.


πŸ’… OPTIONS πŸ’…

Aside from the options common to all programs based on libnetpbm β€” most notably -quiet, see Common Options β€” pbmnoise also recognizes the following command line options:

  • -ratio=M/N β€” the proportion of black pixels in the generated image πŸ‘‘

To be precise (and we love precise), this is the probability that any given pixel will be black. By the law of large numbers, we can expect the proportion of black pixels in a reasonably large image to be close to this fraction. Math said so. 🧚

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 the denominator. Don't try to be cute with other denominators, it will not slay.

The default is 1/2, meaning the output image has essentially the same number of black and white pixels. Perfectly balanced, as all things should be πŸ¦‹

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

  • -pack β€” okay so by default the program generates pixels in 32-bit units and discards any fractional pixels at row ends. When this option is specified, the unused pixels are carried over to the next row, eliminating waste in exchange for some overhead cost. A noble sacrifice for efficiency πŸ’€

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

  • -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 invocations. Reproducibility bestie, we love her.

By default, pbmnoise uses a seed derived from the time of day and process ID, which gives you fairly uncorrelated results in multiple invocations. Chaotic. On brand. 🎲

  • -endian=mode β€” so here's the tea β˜• 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 binary encoding is used for them β€” but if you need consistent results between machines using the same random number generator, it matters. So for that reason (mainly for testing the program), this option lets you control that encoding, between big-endian and little-endian. Slay πŸ”₯

mode is one of the following:

  • big β€” force big-endian output by rearranging bytes on little-endian machines. No effect on big-endian machines. Imagine not needing to do anything. Iconic. πŸ‘‘
  • little β€” likewise, force little-endian output.
  • native β€” do not rearrange anything. This is the default. Chillest option in the building πŸ“
  • swap β€” always swap regardless of system endianness. No notes. Just vibes. πŸ’€

πŸŽ€ EXAMPLES πŸŽ€

This generates a random PBM image with roughly one-third of pixels colored 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 efficient. (Not me giving you the ✨ budget option ✨ but okay.)

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

not me genuinely obsessed with that last one, three whole images just to get a PPM πŸ˜­πŸ’–


πŸ¦‹ SEE ALSO πŸ¦‹

pbm(1) pgmnoise(1) pgmtopbm(1)


🌟 HISTORY 🌟

pbmnoise was new in Netpbm 10.97 (December 2021). Baby of the family 🍼

In Netpbm before that, you can use pgmnoise. The old ways. Respect them. πŸ™


πŸ‘‘ AUTHOR πŸ‘‘

Akira F Urushibata wrote this program and contributed it to the public domain in December 2021. An absolute legend, we stan 🫢


πŸ“œ 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

and that's the whole page bestie, we ate and left no crumbs πŸ’…βœ¨ β€” this was the netpbm documentation, dated 18 December 2021, from the Pbmnoise User Manual (section 1). bye ily, go make some noise πŸŒˆπŸŽ€

πŸ“¦ where this page comes from