Plan 9 from Bell Labs’s /usr/web/sources/contrib/pac/sys/doc/netpbm/ms/pamcut.ms

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TL
Pamcut User Manual
.SH 1
pamcut
.LP
Updated: 05 April 2005
.br
Table Of Contents
.SH 2
NAME
.LP
pamcut - cut a rectangle out of a PAM, PBM, PGM, or PPM image
.SH 2
SYNOPSIS
.LP
\fBpamcut\fR
[\fB-left \fR\fIcolnum\fR]
[\fB-right \fR\fIcolnum\fR]
[\fB-top \fR\fIrownum\fR]
[\fB-bottom \fR\fIrownum\fR]
[\fB-width \fR\fIcols\fR]
[\fB-height \fR\fIrows\fR]
[\fB-pad\fR]
[\fB-verbose\fR]
[\fIleft\fR \fItop\fR \fIwidth\fR \fIheight\fR]
[\fIpnmfile\fR]
.LP
Minimum unique abbreviation of option is 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.
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBpamcut\fR reads a PAM, PBM, PGM, or PPM image as input and
extracts the specified rectangle, and produces the same kind of image
as output.
.LP
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.
.LP
If you use both options and arguments, the two specifications get
mixed in an unspecified way.
.LP
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 \fB-right=9\fR means to delete the 9 rightmost columns.
(It really means keep the stuff up to Column 9 and delete the rest).
.LP
To use options, just code any mixture of the \fB-left\fR,
\fB-right\fR, \fB-top\fR, \fB-bottom\fR, \fB-width\fR, and
\fB-height\fR 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 \fB-left\fR, \fB-right\fR, and \fB-width\fR or
\fB-top\fR, \fB-bottom\fR, and \fB-height\fR.
.LP
To use arguments, specify all four of the \fIleft\fR,
\fItop\fR, \fIwidth\fR, and \fIheight\fR arguments.  \fIleft\fR
and \fItop\fR have the same effect as specifying them as the argument
of a \fB-left\fR or \fB-top\fR option, respectively.  \fIwidth\fR
and \fIheight\fR have the same effect as specifying them as the
argument of a \fB-width\fR or \fB-height\fR 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
\fB-right\fR or \fB-bottom\fR option, respectively.  (E.g.
\fIwidth\fR = 0 makes the cut go all the way to the right edge).
Before July 2000, negative numbers were not allowed for \fIwidth\fR
and \fIheight\fR.
.LP
Input is from Standard Input if you don't specify the input file
\fIpnmfile\fR.
.LP
Output is to Standard Output.
.LP
\fBpamcut\fR 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.
.LP
If you are splitting a single image into multiple same-size images,
\fBpamdice\fR is faster than running \fBpamcut\fR multiple times.
.LP
\fBpamcomp\fR 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.
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-left=\fR\fIcolnum\fR"
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.
.LP
To delete \fIN\fR columns at the left edge, specify
\fB-left=\fR\fIN\fR.
.LP
To delete \fIN\fR columns at the right edge, specify
\fB-left=-\fR\fI-(N+1)\fR.
.IP "\fB-right=\fR\fIcolnum\fR"
The column number of the rightmost column to be in the output,
numbered the same as for \fB-left.\fR  Columns to the right of this
get cut out.
.IP "\fB-top=\fR\fIrownum\fR"
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.
.LP
To delete \fIN\fR rows at the top, specify \fB-top=\fR\fIN\fR.
.LP
To delete \fIN\fR rows at the bottom, specify \fB-bottom=\fR\fI-(N+1)\fR.
.IP "\fB-bottom=\fR\fIrownum\fR"
The row number of the bottom-most row to be in the output,
numbered the same as for \fB-top\fR.  Rows below this get cut out.
.IP "\fB-width=\fR\fIcols\fR"
The number of columns to be in the output.  Must be positive.
.IP "\fB-height=\fR\fIrows\fR"
The number of rows to be in the output.  Must be positive.
.IP "\fB-pad\fR"
If the rectangle you specify is not entirely within the input
image, \fBpamcut\fR fails unless you also specify \fB-pad\fR.  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.
.LP
\fBpnmpad\fR also adds borders to an image, but you specify their
width directly.
.LP
\fBpamcomp\fR 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).
.IP "\fB-verbose\fR"
Print information about the processing to Standard Error.
.RE
.SH 2
SEE ALSO
.LP
\fBpnmcrop\fR,
\fBpamcomp\fR,
\fBpnmpad\fR,
\fBpnmcat\fR,
\fBpgmslice\fR,
\fBpnm\fR
.SH 2
HISTORY
.LP
.LP
\fBpamcut\fR was derived from \fBpnmcut\fR in Netpbm 9.20 (May 2001).
It was the first Netpbm program adapted to the new PAM format and programming
library.
.LP
The predecessor \fBpnmcut\fR was one of the oldest tools in the Netpbm
package.
.SH 2
AUTHOR
.LP
Copyright (C) 1989 by Jef Poskanzer.
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
SEE ALSO
.IP \(bu
AUTHOR
.LP

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.