summaryrefslogtreecommitdiffstats
path: root/upstream/debian-unstable/man1/pamshuffle.1
blob: 42a940a7125aba4e75c49990453901eb2e696798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pamshuffle User Manual" 1 "" "netpbm documentation"

Updated:
.SH NAME
pamshuffle - Shuffle pixels of a Netpbm image

.UN synopsis
.SH SYNOPSIS

\fBpamshuffle\fP
[\fB-column\fP
[\fB-randomseed\fP \fIinteger\fP]]
[\fIpamfile\fP]
.PP
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.

.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpamshuffle\fP 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.
.PP
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.
.PP
To shuffle vertically, or to perform a complete scramble, use
\fBpamshuffle\fP together with \fBpamflip\fP.  See examples below.
.PP
Input is from Standard Input if you don't specify the input file
\fIpamfile\fP.
.PP
Output is to Standard Output.
.PP
\fBpamshuffle\fP works on a multi-image stream.  It operates on
each image in the stream independently and produces a multi-image
stream output.
.PP
The shuffling algorithm is the widely known
.UR https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
 Fisher-Yates method
.UE
\&.


.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see 
.UR index.html#commonoptions
 Common Options
.UE
\&), \fBpamshuffle\fP recognizes the following
command line options:


.TP
\fB-column\fP
Shuffle vertical columns, i.e. perform the same movement on all rows.
Without this option, the program shuffles each row independently.

.TP
\fB-randomseed\fP= \fIinteger\fP
This is the seed for the random number generator that generates the
pixels.
.sp
Use this to ensure you get the same image on separate invocations.
.sp
By default, \fBpamshuffle\fP uses a seed derived from the time of day
and process ID, which gives you quite uncorrelated results in multiple
invocations.



.UN examples
.SH EXAMPLES
.PP
In the following example, output is to Standard Output.  You will probably
want to add redirection to somewhere useful.


.IP \(bu

.sp
\fBpamshuffle\fP is useful when you want to randomize the orderly
output of image generators such as \fBpamseq\fP and \fBpgmramp\fP.
.sp
Produce five permutations of integers 0 to 15:

.nf
\f(CW
pgmramp -lr -maxval=15 16 5 | pamshuffle -plain
\fP

.fi

.IP \(bu
Shuffle columns:

.nf
\f(CW
pamshuffle -column image.ppm
\fP

.fi


.IP \(bu
Shuffle rows:

.nf
\f(CW
pamflip -cw image.ppm | pamshuffle | pamflip -ccw
\fP

.fi

.IP \(bu
Perform complete shuffle:

.nf
\f(CW
pamflip -cw image.ppm | pamshuffle | pamflip -ccw | pamshuffle
\fP

.fi




.UN seealso
.SH SEE ALSO
.BR "pamseq" (1)\c
\&,
.BR "pgmramp" (1)\c
\&,
.BR "pamflip" (1)\c
\&,
.BR "ppmshift" (1)\c
\&,
.BR "ppmspread" (1)\c
\&,
.BR "pam" (1)\c
\&


.UN history
.SH HISTORY
.PP
\fBpamshuffle\fP was new in Netpbm 10.99 (June 2022).


.UN author
.SH AUTHOR

By Akira F. Urushibata.  Contributed to the public domain by the author.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pamshuffle.html
.PP