1Pnmcrop User Manual(0)                                  Pnmcrop User Manual(0)
2
3
4

NAME

6       pnmcrop - crop a PNM image
7
8

SYNOPSIS

10       pnmcrop
11
12       [-white|-black|-sides]
13
14       [-left]
15
16       [-right]
17
18       [-top]
19
20       [-bottom]
21
22       [-margin=pixels]
23
24       [-borderfile=filename]
25
26       [pnmfile]
27
28       Minimum  unique abbreviation of option is acceptable.  You may use dou‐
29       ble hyphens instead of single hyphen to denote options.   You  may  use
30       white space in place of the equals sign to separate an option name from
31       its value.
32
33

DESCRIPTION

35       This program is part of Netpbm(1).
36
37       pnmcrop reads a PBM, PGM, or PPM image as input, removes  borders  that
38       are  the  background color, and produces the same type of image as out‐
39       put.
40
41       If you don't specify otherwise, pnmcrop assumes the background color is
42       whatever  color  the top left and right corners of the image are and if
43       they are different colors, something  midway  between  them.   You  can
44       specify  that  the  background  is  white  or black with the -white and
45       -black options or make pnmcrop base  its  guess  on  all  four  corners
46       instead of just two with -sides.
47
48       By  default, pnmcrop chops off any stripe of background color it finds,
49       on all four sides.  You can tell pnmcrop to remove only  specific  bor‐
50       ders with the -left, -right, -top, and -bottom options.
51
52       If  you want to leave some border, use the -margin option.  It will not
53       only spare some of the border from cropping, but  will  fill  in  (with
54       what  pnmcrop considers the background color) if necessary to get up to
55       that size.
56
57       If the input is a multi-image stream, pnmcrop processes each one  inde‐
58       pendently  and  produces  a  multi-image  stream as output.  It chooses
59       where to crop independently for each image.  So if  you  start  with  a
60       stream  of images of the same dimensions, you may end up with images of
61       differing dimensions.  Before Netpbm  10.37  (December  2006),  pnmcrop
62       ignored all input images but the first.
63
64       If  you  want  to  chop a specific amount off the side of an image, use
65       pamcut.
66
67       If you want to add different borders after removing the existing  ones,
68       use pnmcat or pamcomp.
69
70

OPTIONS

72       -white Take  white to be the background color.  pnmcrop removes borders
73              which are white.
74
75
76       -black Take black to be the background color.  pnmcrop  removes borders
77              which are black.
78
79
80       -sides Determine  the background color from the colors of the four cor‐
81              ners of the input image.  pnmcrop removes borders which  are  of
82              the background color.
83
84              If  at  least three of the four corners are the same color, pnm‐
85              crop  takes that as the background color.  If not, pnmcrop looks
86              for two corners of the same color in the following order, taking
87              the first found as the background color: top, left, right,  bot‐
88              tom.   If all four corners are different colors, pnmcrop assumes
89              an average of the four colors as the background color.
90
91              The -sides option slows pnmcrop down, as  it  reads  the  entire
92              image to determine the background color in addition to the up to
93              three times that it would read it without -sides.
94
95
96       -left  Remove any left border.
97
98
99       -right Remove any right border.
100
101
102       -top   Remove any top border.
103
104
105       -bottom
106              Remove any bottom border.
107
108
109       -margin=pixels
110              Leave pixels pixels of border.  Expand the border to  this  size
111              if necessary.
112
113              This option was new in Netpbm 10.29 (August 2005).
114
115
116       -borderfile=filename
117              Use  the  image  in the file named filename instead of the input
118              image to determine where the borders of the input image are  and
119              the background color.
120
121              Without  this  option, pnmcrop examines the input image and fig‐
122              ures out what part of the image is border and what part is fore‐
123              ground (not border), as well as the background color.  With this
124              option, pnmcrop finds the borders in one image,  then  uses  the
125              those four border sizes (left, right, top, bottom) in cropping a
126              different image.  Furthermore, if you use -margin  to  add  bor‐
127              ders, the color of those borders is the background color pnmcrop
128              detects in the border file.
129
130              The point of this is that you may want to help pnmcrop  to  come
131              to  a  different conclusion as to where the borders are and what
132              the background color is by preprocessing the input  image.   For
133              example,  consider  an  image  that has speckles of noise in its
134              borders.  pnmcrop isn't  smart  enough  to  recognize  these  as
135              noise;  it  sees them as foreground image.  So pnmcrop considers
136              most of your borders to be foreground and does not crop them off
137              as  you  want.   To fix this, run the image through a despeckler
138              such as pbmclean and tell pnmcrop to use the despeckled  version
139              of the image as the -borderfile image, but the original speckled
140              version as the input image.  That way, you crop the borders, but
141              retain the true foreground image, speckles and all.
142
143              This option was new in Netpbm 10.29 (August 2005).
144
145              Before Netpbm 10.46 (March 2009), the original image and not the
146              border file determines the background color.  pnmcrop  fails  if
147              there  is  no  apparent  background  color in the original image
148              (i.e. the corners of the image don't have a common color).
149
150
151       -verbose
152              Print  on  Standard  Error  information  about  the  processing,
153              including exactly how much is being cropped off of which sides.
154
155
156
157

SEE ALSO

159       pamcut(1), pamfile(1), pnm(1)
160
161

AUTHOR

163       Copyright (C) 1989 by Jef Poskanzer.
164
165
166
167netpbm documentation             11 March 2009          Pnmcrop User Manual(0)
Impressum