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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
\
.\" 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 "Pamrestack User Manual" 1 "" "netpbm documentation"
Updated:
.SH NAME
pamrestack - Rearrange rows of a Netpbm image
.UN synopsis
.SH SYNOPSIS
\fBpamrestack\fP
[\fB-width=\fP\fIwidth\fP]
[\fB-trim=\fP{\fBfill\fP|\fBcrop\fP|\fBabort\fP}]
[\fB-verbose\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
\fBpamrestack\fP rearranges the pixels of a Netpbm image into different
size rows. E.g. if an image is 100 pixels wide and 50 pixels high, you can
rearrange it to 125 wide and 40 high. In that case, 25 pixels from the start
of the 2nd row of the input would be moved to the end of the 1st row of input,
50 pixels from the 3rd row would be moved to the 2nd row, etc.
.PP
Put another way, \fBpamrestack\fP arranges all the input rows into one
long sequence and produces output rows therefrom, in FIFO order.
.PP
Input is from Standard Input if you don't specify the input
file \fIpamfile\fP.
.PP
Output is to Standard Output.
.PP
\fBpamrestack\fP works on a multi-image stream. It cuts each image in the
stream independently and produces a multi-image stream output.
.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
\&), \fBpamrestack\fP recognizes the following
command line options:
.TP
\fB-width=\fP\fIwidth\fP
The width of the output. If this option is not specified, the output will
consist of a single row wide enough to contain all the pixels of the input
image.
.TP
\fB-trim=\fP{\fBfill\fP|\fBcrop\fP|\fBabort\fP}
This option specifies what to do when the new width does not cleanly
divide the number of pixels in the input image.
.TP
\fBfill\fP
(Default) Complete the final row by adding black pixels as necessary.
.TP
\fBcrop\fP
Discard the final partial row. If this means there is nothing to
output, fail the program.
.TP
\fBabort\fP
Fail the program..
.TP
\fB-verbose\fP
Print information about the processing to Standard Error.
.UN usage
.SH USAGE
.PP
\fBpamrestack\fP is a general editor with many possible uses.
.IP \(bu
\fBpamrestack\fP can rearrange into rectangles single-dimension images
produced by programs such as \fBppmhist\fP and \fBpamseq\fP. This makes
the output easier to examine with a viewer. Conversely, \fBpamrestack\fP
can be used to convert a normal rectangular image into one wide row or one
tall column if that is desirable for compression, conversion, or analysis.
.IP \(bu
\fBpamrestack\fP can repair images corrupted by an incorrect width value
in the header. Images grabbed from the framebuffer device often exhibit
this problem.
.IP \(bu
\fBpamrestack\fP can be used with \fBpamdice\fP, \fBpamundice\fP,
\fBpamcat\fP, etc. to divide and combine images in the process of
interlacing.
.UN examples
.SH EXAMPLES
.IP \(bu
Rearrange the one-dimensional output of \fBpamseq\fP into a square:
.nf
\f(CW
pamseq 3 255 | pamrestack -width=4096
\fP
.fi
.IP \(bu
Combine two files, each 600 pixels wide, one with the odd rows and
another with the even rows, to construct an interlaced image:
.nf
\f(CW
pamcat -leftright oddrows.ppm evenrows.ppm | pamrestack -width=600
\fP
.fi
.IP \(bu
Like the above, but invert all pixels in the even rows left to right
to produce a serpentine interlace:
.nf
\f(CW
pamflip -leftright evenrows.ppm |
pamcat -leftright oddrows.ppm - |
pamrestack -width 600
\fP
.fi
.UN seealso
.SH SEE ALSO
.BR "pamseq" (1)\c
\&,
.BR "ppmhist" (1)\c
\&,
.BR "pnmshear" (1)\c
\&,
.BR "pamscale" (1)\c
\&,
.BR "pamdeinterlace" (1)\c
\&,
.BR "pamdice" (1)\c
\&,
.BR "pamundice" (1)\c
\&,
.BR "pamcat" (1)\c
\&,
.BR "pam" (1)\c
\&
.UN history
.SH HISTORY
.PP
\fBpamrestack\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/pamrestack.html
.PP
|