Blame


1 058b0118 2005-01-03 devnull .TH CROP 1
2 058b0118 2005-01-03 devnull .SH NAME
3 058b0118 2005-01-03 devnull crop, iconv \- frame, crop, and convert image
4 058b0118 2005-01-03 devnull .SH SYNOPSIS
5 058b0118 2005-01-03 devnull .B crop
6 058b0118 2005-01-03 devnull [
7 058b0118 2005-01-03 devnull .BI -c
8 058b0118 2005-01-03 devnull .I red
9 058b0118 2005-01-03 devnull .I green
10 058b0118 2005-01-03 devnull .I blue
11 058b0118 2005-01-03 devnull ]
12 058b0118 2005-01-03 devnull [
13 058b0118 2005-01-03 devnull .B -i
14 058b0118 2005-01-03 devnull .I n
15 058b0118 2005-01-03 devnull |
16 058b0118 2005-01-03 devnull .B -x
17 058b0118 2005-01-03 devnull .I dx
18 058b0118 2005-01-03 devnull |
19 058b0118 2005-01-03 devnull .B -y
20 058b0118 2005-01-03 devnull .I dy
21 058b0118 2005-01-03 devnull |
22 058b0118 2005-01-03 devnull .B -r
23 058b0118 2005-01-03 devnull .I minx
24 058b0118 2005-01-03 devnull .I miny
25 058b0118 2005-01-03 devnull .I maxx
26 058b0118 2005-01-03 devnull .I maxy
27 058b0118 2005-01-03 devnull ]
28 058b0118 2005-01-03 devnull [
29 058b0118 2005-01-03 devnull .B -t
30 058b0118 2005-01-03 devnull .I tx
31 058b0118 2005-01-03 devnull .I ty
32 058b0118 2005-01-03 devnull ]
33 058b0118 2005-01-03 devnull [
34 058b0118 2005-01-03 devnull .B -b
35 058b0118 2005-01-03 devnull .I red
36 058b0118 2005-01-03 devnull .I green
37 058b0118 2005-01-03 devnull .I blue
38 058b0118 2005-01-03 devnull ]
39 058b0118 2005-01-03 devnull [
40 058b0118 2005-01-03 devnull .I file
41 058b0118 2005-01-03 devnull ]
42 058b0118 2005-01-03 devnull .PP
43 058b0118 2005-01-03 devnull .B iconv
44 058b0118 2005-01-03 devnull [
45 058b0118 2005-01-03 devnull .B -u
46 058b0118 2005-01-03 devnull ] [
47 058b0118 2005-01-03 devnull .B -c
48 058b0118 2005-01-03 devnull .I chandesc
49 058b0118 2005-01-03 devnull ]
50 058b0118 2005-01-03 devnull [
51 058b0118 2005-01-03 devnull .I file
52 058b0118 2005-01-03 devnull ]
53 058b0118 2005-01-03 devnull .SH DESCRIPTION
54 058b0118 2005-01-03 devnull .I Crop
55 058b0118 2005-01-03 devnull reads an
56 d32deab1 2020-08-16 rsc .MR image (7)
57 058b0118 2005-01-03 devnull file (default standard input), crops it, and writes it as a compressed
58 d32deab1 2020-08-16 rsc .MR image (7)
59 058b0118 2005-01-03 devnull file to standard output.
60 058b0118 2005-01-03 devnull There are two ways to specify a crop, by color value or by geometry.
61 058b0118 2005-01-03 devnull They may be combined in a single run of
62 058b0118 2005-01-03 devnull .IR crop ,
63 058b0118 2005-01-03 devnull in which case the color value crop will be done first.
64 058b0118 2005-01-03 devnull .PP
65 058b0118 2005-01-03 devnull The
66 058b0118 2005-01-03 devnull .B -c
67 058b0118 2005-01-03 devnull option takes a red-green-blue triplet as described in
68 d32deab1 2020-08-16 rsc .MR color (3) .
69 058b0118 2005-01-03 devnull (For example, white
70 058b0118 2005-01-03 devnull is
71 058b0118 2005-01-03 devnull .B 255
72 058b0118 2005-01-03 devnull .B 255
73 058b0118 2005-01-03 devnull .BR 255 .)
74 058b0118 2005-01-03 devnull The corresponding color is used as a value to be cut from the outer
75 058b0118 2005-01-03 devnull edge of the picture; that is, the image is cropped to remove the maximal
76 058b0118 2005-01-03 devnull outside rectangular strip in which every pixel has the specified color.
77 058b0118 2005-01-03 devnull .PP
78 058b0118 2005-01-03 devnull The
79 058b0118 2005-01-03 devnull .B -i
80 058b0118 2005-01-03 devnull option insets the image rectangle by a constant amount,
81 058b0118 2005-01-03 devnull .IR n ,
82 058b0118 2005-01-03 devnull which may be negative to generate extra space around the image.
83 058b0118 2005-01-03 devnull The
84 058b0118 2005-01-03 devnull .B -x
85 058b0118 2005-01-03 devnull and
86 058b0118 2005-01-03 devnull .B -y
87 058b0118 2005-01-03 devnull options are similar, but apply only to the
88 058b0118 2005-01-03 devnull .I x
89 058b0118 2005-01-03 devnull or
90 058b0118 2005-01-03 devnull .I y
91 058b0118 2005-01-03 devnull coordinates of the image.
92 058b0118 2005-01-03 devnull .PP
93 058b0118 2005-01-03 devnull The
94 058b0118 2005-01-03 devnull .B -r
95 058b0118 2005-01-03 devnull option specifies an exact rectangle.
96 058b0118 2005-01-03 devnull .PP
97 058b0118 2005-01-03 devnull The
98 058b0118 2005-01-03 devnull .B -t
99 058b0118 2005-01-03 devnull option specifies that the image's coordinate system should
100 058b0118 2005-01-03 devnull be translated by
101 058b0118 2005-01-03 devnull .IR tx ,
102 058b0118 2005-01-03 devnull .IR ty
103 058b0118 2005-01-03 devnull as the last step of processing.
104 058b0118 2005-01-03 devnull .PP
105 058b0118 2005-01-03 devnull The
106 058b0118 2005-01-03 devnull .B -b
107 058b0118 2005-01-03 devnull option specifies a background color to be used to fill around the image
108 058b0118 2005-01-03 devnull if the cropped image is larger than the original, such as if the
109 058b0118 2005-01-03 devnull .B -i
110 058b0118 2005-01-03 devnull option is given a negative argument.
111 058b0118 2005-01-03 devnull This can be used to draw a monochrome frame around the image.
112 058b0118 2005-01-03 devnull The default color is black.
113 058b0118 2005-01-03 devnull .PP
114 058b0118 2005-01-03 devnull .I Iconv
115 058b0118 2005-01-03 devnull changes the format of pixels in the image
116 058b0118 2005-01-03 devnull .I file
117 058b0118 2005-01-03 devnull (default standard input) and writes the resulting image to standard output.
118 058b0118 2005-01-03 devnull Pixels in the image are converted according to the channel descriptor
119 058b0118 2005-01-03 devnull .IR chandesc ,
120 058b0118 2005-01-03 devnull (see
121 d32deab1 2020-08-16 rsc .MR image (7) ).
122 058b0118 2005-01-03 devnull For example, to convert a 4-bit-per-pixel grey-scale image to an 8-bit-per-pixel
123 058b0118 2005-01-03 devnull color-mapped image,
124 058b0118 2005-01-03 devnull .I chandesc
125 058b0118 2005-01-03 devnull should be
126 058b0118 2005-01-03 devnull .BR m8 .
127 058b0118 2005-01-03 devnull If
128 058b0118 2005-01-03 devnull .I chandesc
129 058b0118 2005-01-03 devnull is not given, the format is unchanged.
130 058b0118 2005-01-03 devnull The output image is by default compressed; the
131 058b0118 2005-01-03 devnull .B -u
132 058b0118 2005-01-03 devnull option turns off the compression.
133 058b0118 2005-01-03 devnull .SH EXAMPLE
134 058b0118 2005-01-03 devnull To crop white edges off the picture and add a ten-pixel pink border,
135 058b0118 2005-01-03 devnull .IP
136 058b0118 2005-01-03 devnull .EX
137 058b0118 2005-01-03 devnull crop -c 255 255 255 -i -10 -b 255 150 150 imagefile > cropped
138 058b0118 2005-01-03 devnull .EE
139 058b0118 2005-01-03 devnull .SH SOURCE
140 c3674de4 2005-01-11 devnull .B \*9/src/cmd/draw/crop.c
141 058b0118 2005-01-03 devnull .SH SEE ALSO
142 d32deab1 2020-08-16 rsc .MR image (7) ,
143 d32deab1 2020-08-16 rsc .MR color (3)
144 058b0118 2005-01-03 devnull .SH BUGS
145 058b0118 2005-01-03 devnull .I Iconv
146 058b0118 2005-01-03 devnull should be able to do Floyd-Steinberg error diffusion or dithering
147 058b0118 2005-01-03 devnull when converting to small image depths.