Minimum unique abbreviation of option is acceptable. You may use dou-
ble 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.
This program is part of Netpbm.
pnmcrop reads a PBM, PGM, or PPM image as input, removes borders that
are the background color, and produces the same type of image as out-
If you don't specify otherwise, pnmcrop assumes the background color
is whatever color the top left and right corners of the image are and
if they are different colors, something midway between them. You can
specify that the background is white or black with the -white and
-black options or make pnmcrop base its guess on all four corners
instead of just two with -sides.
By default, pnmcrop chops off any stripe of background color it finds,
on all four sides. You can tell pnmcrop to remove only specific bor-
ders with the -left, -right, -top, and -bottom options.
If you want to leave some border, use the -margin option. It will not
only spare some of the border from cropping, but will fill in (with
what pnmcrop considers the background color) if necessary to get up to
If the input is a multi-image stream, pnmcrop processes each one inde-
pendently and produces a multi-image stream as output. It chooses
where to crop independently for each image. So if you start with a
stream of images of the same dimensions, you may end up with images of
differing dimensions. Before Netpbm 10.37 (December 2006), pnmcrop
ignored all input images but the first.
If you want to chop a specific amount off the side of an image, use
If you want to add different borders after removing the existing ones,
use pnmcat or pamcomp.
-white Take white to be the background color. pnmcrop removes borders
-black Take black to be the background color. pnmcrop removes bor-
-sides Determine the background color from the colors of the four cor-
-left Remove any left border.
-right Remove any right border.
-top Remove any top border.
pamcut, pamfile, pnm
Copyright (C) 1989 by Jef Poskanzer.
netpbm documentation 30 November 2006 Pnmcrop User Manual(0)