about summary refs log tree commit diff
path: root/pamcut.html
blob: 40c9d39c4d031ca6787665296863a57fa64d130f (plain) (blame)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pamcut User Manual</TITLE></HEAD>
<BODY>
<H1>pamcut</H1>
Updated: 05 April 2005
<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>-verbose</B>]

[<I>left</i> <i>top</i> <i>width</i> <i>height</I>]

[<I>pnmfile</I>]

<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>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.

<P>There are two ways to specify the rectangle to cut: arguments and
options.  Options are easier to remember and read, more expressive,
and allow you to use defaults.  Arguments were the only way available
before July 2000.

<P>If you use both options and arguments, the two specifications get
mixed in an unspecified way.

<p>In any case, remember that you are specifying the rectangle to
keep, not the bits to discard.  Otherwise, you'll be tempted to
believe that <b>-right=9</b> means to delete the 9 rightmost columns.
(It really means keep the stuff up to Column 9 and delete the rest).

<P>To use options, just code any mixture of the <B>-left</B>,
<B>-right</B>, <B>-top</B>, <B>-bottom</B>, <B>-width</B>, and
<B>-height</B> 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>.

<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.

<p>To delete <i>N</i> columns at the left edge, specify
<b>-left=</b><i>N</i>.

<p>To delete <i>N</i> columns at the right edge, specify
<b>-left=-</b><i>-(N+1)</i>.

<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.

<p>To delete <i>N</i> rows at the top, specify <b>-top=</b><i>N</i>.

<p>To delete <i>N</i> rows at the bottom, specify <b>-bottom=</b><i>-(N+1)</i>.

<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>-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>