croptool.1 - croptool - Image cropping tool
HTML git clone git://lumidify.org/croptool.git (fast, but not encrypted)
HTML git clone https://lumidify.org/git/croptool.git (encrypted, but very slow)
HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/croptool.git (over tor)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
croptool.1 (6868B)
---
1 .Dd July 12, 2026
2 .Dt CROPTOOL 1
3 .Os
4 .Sh NAME
5 .Nm croptool
6 .Nd mass image cropping tool
7 .Sh SYNOPSIS
8 .Nm
9 .Op Ar -mr
10 .Op Ar -f format
11 .Op Ar -w width
12 .Op Ar -c padding
13 .Op Ar -p color
14 .Op Ar -s color
15 .Op Ar -z size
16 .Ar file ...
17 .Sh DESCRIPTION
18 .Nm
19 shows each of the given images and allows a cropping rectangle to be drawn.
20 When the keyboard command
21 .Sq q
22 is used to exit, the cropping command is printed for each of the images.
23 If an image was skipped, nothing is printed for it.
24 .Sh OPTIONS
25 .Bl -tag -width Ds
26 .It Fl m
27 Disable automatic redrawing when the window is resized (the
28 .Fl m
29 stands for 'manual').
30 This may be useful on older machines that start accelerating global
31 warming when the image is redrawn constantly while resizing.
32 Note that this also disables exposure events, so the window has to be
33 manually redrawn when switching back to it from another window.
34 .It Fl r
35 Disable automatic redrawing while the cropping box is being dragged or
36 resized, for the same reason as
37 .Fl m .
38 .It Fl f Ar format
39 Set the format to be used when the cropping commands are output.
40 See
41 .Sx OUTPUT FORMAT
42 for details.
43 .It Fl w Ar width
44 Set the line width of the cropping rectangle in pixels (valid values:
45 1-99).
46 Default: 2.
47 .It Fl c Ar padding
48 Set the amount of padding used for collision with the mouse in pixels.
49 This determines how far away the mouse pointer has to be from an edge
50 or corner of the cropping rectangle to collide with it (valid values:
51 1-99).
52 Default: 10.
53 .It Fl p Ar color
54 Set the primary color for the cropping rectangle.
55 Default: #000000.
56 .It Fl s Ar color
57 Set the secondary color for the cropping rectangle.
58 Default: #FFFFFF.
59 .It Fl z Ar size
60 Set the Imlib2 in-memory cache to
61 .Ar size
62 MiB (valid values: 0-1024).
63 Default: 4.
64 .El
65 .Sh OUTPUT FORMAT
66 The cropping commands for each image are output using the format given by
67 .Fl f ,
68 or the default of
69 .Ql croptool_crop %wx%h+%l+%t '%f' .
70 .Pp
71 The following substitutions are performed:
72 .Bl -tag -width Ds
73 .It %%
74 Print
75 .Ql % .
76 .It %w
77 Print the width of the cropping rectangle in pixels.
78 .It %h
79 Print the height of the cropping rectangle in pixels.
80 .It %l
81 Print the location of the left side of the cropping rectangle in pixels.
82 .It %r
83 Print the location of the right side of the cropping rectangle in pixels.
84 .It %t
85 Print the location of the top side of the cropping rectangle in pixels.
86 .It %b
87 Print the location of the bottom side of the cropping rectangle in pixels.
88 .It %f
89 Print the filename of the image.
90 Warning: This is printed as is, without any escaping.
91 .El
92 .Pp
93 If an unknown substitution is encountered, a warning is printed to
94 standard error and the characters are printed verbatim.
95 .Pp
96 Note that the coordinates are adjusted so they are entirely within the
97 image, even if the original cropping rectangle was located partially
98 outside.
99 If the cropping rectangle was located entirely outside of the image,
100 no command is printed for it.
101 .Sh KEYBOARD COMMANDS
102 .Bl -tag -width Ds
103 .It ARROW LEFT
104 Go to the previous image.
105 .It ARROW RIGHT
106 Go to the next image.
107 .It RETURN
108 Go to the next image, copying the current cropping rectangle.
109 Note that this copies the visual rectangle, not the rectangle
110 that is printed for the cropping command.
111 In other words, when switching to an image that is a different size and
112 thus scaled differently, the displayed rectangle will stay the same even
113 though the pixels covered in the original image are different.
114 .It SHIFT + RETURN
115 Go to the previous image, copying the current cropping rectangle.
116 The same caveat as above applies.
117 .It TAB
118 Switch the color of the cropping rectangle between the primary and
119 secondary colors.
120 .It DELETE
121 Remove the cropping rectangle of the current image.
122 .It SPACE
123 Redraw the window.
124 This is useful when automatic redrawing is disabled with
125 .Fl m .
126 .It CTRL + a
127 Select the entire image, i.e. make the cropping rectangle cover the entire
128 image.
129 .It y
130 Copy the current visual rectangle, to be pasted later on another image.
131 .It Y
132 Copy the current real rectangle, to be pasted later on another image.
133 This copies the real cropping rectangle for the original, non-scaled image
134 (i.e. the rectangle that is printed for the cropping command).
135 Thus, if it is pasted later on an image that has a different size and is
136 scaled differently, the visual rectangle over the scaled image might look
137 different, but the pixels covered in the original image are the same
138 (unless the rectangle goes outside the bounds of the image, of course).
139 .It p
140 Paste the rectangle that was previously copied.
141 .It q
142 Exit the program, printing the cropping command for any images with a
143 cropping rectangle set.
144 If the window is closed through some other means, no commands are printed.
145 .El
146 .Sh MOUSE ACTIONS
147 .Bl -tag -width Ds
148 .It LEFT-CLICK
149 When inside an existing cropping rectangle, drag it around.
150 When on one of the edges, resize the rectangle, locking it to that axis.
151 When on one of the corners, resize the rectangle regardless of axis.
152 When outside an existing cropping rectangle, replace the current rectangle
153 with a new one.
154 .El
155 .Sh EXIT STATUS
156 .Ex -std
157 .Sh EXAMPLES
158 Normal usage:
159 .Bd -literal
160 $ croptool *.jpg > tmp.sh
161 $ sh tmp.sh
162 .Ed
163 .Pp
164 Or, if you're brave:
165 .Bd -literal
166 $ croptool *.jpg | sh
167 .Ed
168 .Pp
169 It is also possible to do more advanced things.
170 For instance, to save cropped images into a separate directory instead of
171 overwriting the original images, something like this can be done:
172 .Bd -literal
173 $ croptool -f "croptool_crop %wx%h+%l+%t '%f' '/path/to/cropped/%f'" *.jpg | sh
174 .Ed
175 .Pp
176 If more advanced features are needed for the actual cropping (e.g. a
177 different output format), other tools such as
178 .Xr convert 1
179 can be used:
180 .Bd -literal
181 $ croptool -f 'convert -crop %wx%h+%l+%t "%f" "$(basename "%f" .jpg).png"' *.jpg | sh
182 .Ed
183 .Pp
184 With
185 .Xr convert 1
186 or
187 .Xr mogrify 1 ,
188 it is also possible to specify the compression level for JPEG images:
189 .Bd -literal
190 $ croptool -f 'mogrify -quality 90 -crop %wx%h+%l+%t "%f"' *.jpg | sh
191 .Ed
192 .Pp
193 Using
194 .Xr convert 1
195 or
196 .Xr mogrify 1
197 has the additional benefit of preserving the EXIF tags embedded in an image,
198 which is a feature
199 .Xr croptool_crop 1
200 currently lacks.
201 .Pp
202 For ImageMagick 7,
203 .Ql convert
204 and
205 .Ql mogrify
206 need to be replaced with
207 .Ql magick
208 and
209 .Ql magick mogrify ,
210 respectively.
211 .Pp
212 Note that no great care has been taken to deal with filenames containing
213 single or double quotes.
214 That is left as an exercise to the reader (hint: just don't have
215 filenames containing quotes).
216 .Sh SEE ALSO
217 .Xr convert 1 ,
218 .Xr croptool_crop 1 ,
219 .Xr ImageMagick 1 ,
220 .Xr mogrify 1 ,
221 .Xr selectool 1
222 .Sh AUTHORS
223 .An lumidify Aq Mt nobody@lumidify.org
224 .Sh BUGS
225 The filenames are printed without any escaping, so filenames with
226 quotes may cause issues depending on the output format.
227 .Pp
228 Transparent portions of images should probably be shown differently,
229 but I'm too lazy to fix that and don't really care at the moment.