Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pamcut User Manual</TITLE></HEAD>
<BODY>
<H1>pamcut</H1>
Updated: 30 April 2017
<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>]

<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>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>-right=-</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>