Minimum unique abbreviations of option are acceptable. 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.
This program is part of Netpbm.
pamshuffle reads a Netpbm image as input and produces an output file with the pixels shuffled. The operation only changes the location of existing pixels; nothing is discarded or added.
By default, pixels change location within rows independently, but it is also possible to perform the same shuffle on every row, meaning the program is shuffling vertical columns of pixels. Either way, there is no vertical rearrangement; this means images consisting entirely of horizontal stripes, such as the national banners of Germany, Thailand and Ukraine, will be unchanged.
To shuffle vertically, or to perform a complete scramble, use pamshuffle together with pamflip. See examples below.
Input is from Standard Input if you don't specify the input file pamfile.
Output is to Standard Output.
pamshuffle works on a multi-image stream. It operates on each image in the stream independently and produces a multi-image stream output.
The shuffling algorithm is the widely known Fisher-Yates method.
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamshuffle recognizes the following command line options:
Use this to ensure you get the same image on separate invocations.
By default, pamshuffle uses a seed derived from the time of day and process ID, which gives you quite uncorrelated results in multiple invocations.
In the following example, output is to Standard Output. You will probably want to add redirection to somewhere useful.
pamshuffle is useful when you want to randomize the orderly output of image generators such as pamseq and pgmramp.
Produce five permutations of integers 0 to 15:
pgmramp -lr -maxval=15 16 5 | pamshuffle -plain
pamshuffle -column image.ppm
pamflip -cw image.ppm | pamshuffle | pamflip -ccw
pamflip -cw image.ppm | pamshuffle | pamflip -ccw | pamshuffle
pamshuffle was new in Netpbm 10.99 (June 2022).