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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pamcut User Manual</TITLE></HEAD>
<BODY>
<H1>pamcut</H1>
Updated: 04 October 2019
<BR>
<A HREF="#index">Table Of Contents</A>
<H2>NAME</H2>
pamcut - cut a rectangle out of a PAM, PBM, PGM, or PPM image
<H2 id="synopsis">SYNOPSIS</H2>
<B>pamcut</B>
[<B>-left </B><I>colnum</I>]
[<B>-right </B><I>colnum</I>]
[<B>-top </B><I>rownum</I>]
[<B>-bottom </B><I>rownum</I>]
[<B>-width </B><I>cols</I>]
[<B>-height </B><I>rows</I>]
[<B>-pad</B>]
[<B>-cropleft </B><I>numcols</I>]
[<B>-cropright </B><I>numcols</I>]
[<B>-croptop </B><I>numrows</I>]
[<B>-cropbottom </B><I>numrows</I>]
[<B>-verbose</B>]
[<I>left</i> <i>top</i> <i>width</i> <i>height</I>]
[<I>pnmfile</I>]
<P>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.
<H2 id="description">DESCRIPTION</H2>
<p>This program is part of <a href="index.html">Netpbm</a>.
<p><B>pamcut</b> reads a PAM, PBM, PGM, or PPM image as input and
extracts the specified rectangle, and produces the same kind of image
as output.
<p>You can specify either the rectangle to cut out and keep or specify the
edges to crop off and discard, or a combination.
<p>To request edges be cropped off, use options <b>-cropleft</b>,
<b>-cropright</b>, <b>-croptop</b>, and <b>-cropbottom</b> to indicate how many
rows or columns to discard.
<p>For example, <b>-cropleft=50 -cropright=200</b> means to discard the
leftmost 50 and rightmost 200 columns.
<p>To specify the rectangle to keep, use <b>-left</b>, <b>-right</b>,
<b>-top</b>, <b>-bottom</b>, <b>-width</b>, <b>-height</b>, and <b>-pad</b>
options.
<p>For example, <b>-left=50 -right=200</b> means to keep the 150 columns
between Columns 50 and 200 inclusive.
<P>You can code any mixture of the options. What you don't specify defaults.
Those defaults are in favor of minimal cutting and in favor of cutting the
right and bottom edges off. It is an error to overspecify, i.e. to specify
all three of <B>-left</B>, <B>-right</B>, and <B>-width</B> or <B>-top</B>,
<B>-bottom</B>, and <B>-height</B> or <b>right</b> as well as
<b>-cropright</b>.
<P>There is an older way to specify the rectangle to keep: positional
arguments. Arguments were the only way available before July 2000, but you
should not use them in new applications. Options are easier to remember and
read, more expressive, and allow you to use defaults.
<P>If you use both options and arguments, the two specifications get
mixed in an unspecified way.
<P>To use arguments, specify all four of the <I>left</I>,
<I>top</I>, <I>width</I>, and <I>height</I> arguments. <I>left</I>
and <I>top</I> have the same effect as specifying them as the argument
of a <B>-left</B> or <B>-top</B> option, respectively. <I>width</I>
and <I>height</I> have the same effect as specifying them as the
argument of a <B>-width</B> or <B>-height</B> option, respectively,
where they are positive. Where they are not positive, they have the
same effect as specifying one less than the value as the argument to a
<B>-right</B> or <B>-bottom</B> option, respectively. (E.g.
<I>width</I> = 0 makes the cut go all the way to the right edge).
Before July 2000, negative numbers were not allowed for <I>width</I>
and <I>height</I>.
<P>Input is from Standard Input if you don't specify the input file
<I>pnmfile</I>.
<P>Output is to Standard Output.
<p><b>pamcut</b> works on a multi-image stream. It cuts each image in the
stream independently and produces a multi-image stream output. Before
Netpbm 10.32 (March 2006), it ignored all but the first image in the stream.
<P>If you are splitting a single image into multiple same-size images,
<B>pamdice</B> is faster and easier than running <B>pamcut</B>
multiple times.
<p><b>pamcomp</b> is also useful for cutting and padding an image to a
certain size. You create a background image of the desired frame
dimensions and overlay the subject image on it.
<H2 id="options">OPTIONS</H2>
<DL COMPACT>
<DT><B>-left=</B><i>colnum</i>
<DD>The column number of the leftmost column to be in the output.
Columns left of this get cut out. If a nonnegative number, it refers
to columns numbered from 0 at the left, increasing to the right. If
negative, it refers to columns numbered -1 at the right, decreasing to
the left.
<DT><B>-right=</B><i>colnum</i>
<DD>The column number of the rightmost column to be in the output,
numbered the same as for <B>-left.</B> Columns to the right of this
get cut out.
<DT><B>-top=</B><i>rownum</i>
<DD>The row number of the topmost row to be in the output. Rows above
this get cut out. If a nonnegative number it refers to rows numbered
from 0 at the top, increasing downward. If negative, it refers to
columns numbered -1 at the bottom, decreasing upward.
<DT><B>-bottom=</B><i>rownum</i>
<DD>The row number of the bottom-most row to be in the output,
numbered the same as for <B>-top</B>. Rows below this get cut out.
<DT><B>-width=</B><i>cols</i>
<DD>The number of columns to be in the output. Must be positive.
<DT><B>-height=</B><i>rows</i>
<DD>The number of rows to be in the output. Must be positive.
<DT><B>-cropleft</B>
<DT><B>-cropright</B>
<DT><B>-croptop</B>
<DT><B>-cropbottom</B>
<dd>These options tell how many rows or columns to crop from the left,
right, top, or bottom edges, respectively.
<p>The value must not be negative.
<p>These option were new in Netpbm 10.85 (December 2018). Before that, you
can achieve the same thing with <b>-left</b>, <b>top</b>, and negative values
for <b>-right</b> and <b>-bottom</b>. Remember to subtract one in the latter
case; e.g. the equivalent of <b>-cropright=1</b> is <b>-right=-2</b>.
<DT><B>-pad</B>
<DD>If the rectangle you specify is not entirely within the input
image, <B>pamcut</B> fails unless you also specify <B>-pad</B>. In
that case, it pads the output with black up to the edges you specify.
You can use this option if you need to have an image of certain
dimensions and have an image of arbitrary dimensions.
<P><B>pnmpad</B> also adds borders to an image, but you specify their
width directly.
<p><b>pamcomp</b> does a more general form of this padding. Create a
background image of the frame dimensions and overlay the subject image
on it. You can use options to have the subject image in the center of
the frame or against any edge and make the padding any color (the padding
color is the color of the background image).
<DT><B>-verbose</B>
<DD>
Print information about the processing to Standard Error.
</DL>
<H2 id="seealso">SEE ALSO</H2>
<B><A HREF="pnmcrop.html">pnmcrop</A></B>,
<B><A HREF="pamdice.html">pamdice</A></B>,
<B><A HREF="pamcomp.html">pamcomp</A></B>,
<B><A HREF="pnmpad.html">pnmpad</A></B>,
<B><A HREF="pnmcat.html">pnmcat</A></B>,
<B><A HREF="pgmslice.html">pgmslice</A></B>,
<B><A HREF="pnm.html">pnm</A></B>
<h2 id="history">HISTORY</h2>
<P><B>pamcut</b> was derived from <b>pnmcut</b> in Netpbm 9.20 (May 2001).
It was the first Netpbm program adapted to the new PAM format and programming
library.
<p>The predecessor <b>pnmcut</b> was one of the oldest tools in the Netpbm
package.
<H2 id="author">AUTHOR</H2>
Copyright (C) 1989 by Jef Poskanzer.
<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>
|