croptool

Image cropping tool
git clone git://lumidify.org/croptool.git (fast, but not encrypted)
git clone https://lumidify.org/croptool.git (encrypted, but very slow)
git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/croptool.git (over tor)
Log | Files | Refs | README | LICENSE

README (3680B)


      1 Note (2021-01-01): This is now the old gtk2 version. The new version
      2 is based on xlib and imlib2, but this version should still keep
      3 working. What follows is the original README.
      4 
      5 Requirements: gtk2 (which requires cairo and the other crap anyways)
      6 
      7 This is a small image cropping tool. It was actually written to help
      8 crop large amounts of pictures when digitizing books, but it can be
      9 used for cropping single pictures as well. There are probably many
     10 bugs still. Oh, and the code probably isn't that great.
     11 
     12 Note that the whole image is redrawn when changing the selection
     13 because I'm too dumb to change that, so it may occasionally lag
     14 a little bit. It barely lags on my nice laptop with a single-core
     15 Intel Celeron 2.00 Ghz from 2008, though, so that shouldn't be a
     16 huge problem.
     17 
     18 Just start it with "croptool <image files>" and a window will pop up.
     19 Initially, no image is shown, so you first have to press enter or
     20 right arrow to go to the first image. When an image is shown, you can
     21 click on it to create a selection box. If you click near the edges or
     22 corners of the box, you can change its size, and if you click anywhere
     23 in the middle, you can move it. Clicking outside creates a new box.
     24 I don't know if all of the collision logic is entirely correct, so
     25 tell me if you notice any problems.
     26 
     27 Several keys are recognized:
     28 * Enter and right arrow both go to the next image, but enter copies the
     29   selection box from the current image and uses it for the next picture,
     30   while right arrow just goes to the next image and only displays a
     31   selection box if it already had one. This is so that lots of pages
     32   of a digitized book can be cropped quickly since the selection box
     33   needs to be tweaked occasionally (my digitizing equipment, if it
     34   can be called that, isn't exactly very professional).
     35 * Left arrow just goes to the previous picture.
     36 * Delete removes the selection for the current image (this is then
     37   also not printed out at the end).
     38 * Space bar resizes the image if the window was resized.
     39 * Tab switches the color of the selection box between the two colors
     40   defined at the top of `croptool.c` (SELECTION_COLOR1, SELECTION_COLOR2).
     41 
     42 Note that resizing the window currently does not resize the images.
     43 It will only take effect if you move to another image or press
     44 space bar. A side effect of this is that the image usually is 
     45 displayed at the wrong size when the window initially opens in a
     46 tiling window manager because the window is first mapped at the
     47 requested (500x500) size and then resized by the window manager.
     48 Just press space bar if that happens (it hasn't bothered me too
     49 much up til now, and I use dwm). There may be bugs lurking here
     50 as well since the actual cropping box needs to be rescaled according
     51 to how much the image was scaled for display.
     52 
     53 When the window is closed, the ImageMagick command (mogrify -crop...)
     54 for cropping each of the pictures that had a selection box defined
     55 is printed (including the image currently being edited). If the box
     56 was completely outside of the image, nothing is printed. If only part
     57 of it was outside of the image, it is adjusted so that only the part
     58 inside the image is printed.
     59 
     60 Configuration:
     61 
     62 If you want to, you can edit a few things at the top of `bookcrop.c`.
     63 COLLISION_PADDING is the number of pixels to check for collision if
     64 an edge or corner is clicked.
     65 SELECTION_COLOR1 and SELECTION_COLOR2 are the two colors for the
     66 selection box that can be switched with tab.
     67 If you want to change the command that is output, you can change
     68 the function `print_cmd`. It just receives the filename, the coordinates
     69 of the top left corner of the cropping box, and the width and height
     70 of the box.