croptool

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

commit 0cb921097da75cd5b5a689f5ec79b11eb4bdad80
parent cddaf1fa451de53f5de300768988db96c48cb500
Author: lumidify <nobody@lumidify.org>
Date:   Tue, 21 Sep 2021 16:28:54 +0200

Clean up a bit

Diffstat:
Mcroptool.1 | 11+++++++++--
Mcroptool.c | 5++++-
Mcroptool_crop.1 | 2+-
3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/croptool.1 b/croptool.1 @@ -63,6 +63,7 @@ The cropping commands for each image are output using the format given by .Fl f , or the default of .Ql croptool_crop %wx%h+%l+%t '%f' . +.Pp The following substitutions are performed: .Bl -tag -width Ds .It %% @@ -87,10 +88,16 @@ Warning: This is printed as is, without any escaping. .Pp If an unknown substitution is encountered, a warning is printed to standard error and the characters are printed verbatim. +.Pp +Note that the coordinates are adjusted so they are entirely within the +image, even if the original cropping rectangle was located partially +outside. +If the cropping rectangle was located entirely outside of the image, +no command is printed for it. .Sh KEYBINDS .Bl -tag -width Ds .It ARROW LEFT -Go to the last image. +Go to the previous image. .It ARROW RIGHT Go to the next image. .It RETURN @@ -101,7 +108,7 @@ In other words, when switching to an image that is a different size and thus scaled differently, the displayed rectangle will stay the same even though the pixels covered in the original image are different. .It SHIFT + RETURN -Go to the last image, copying the current cropping rectangle. +Go to the previous image, copying the current cropping rectangle. The same caveat as above applies. .It TAB Switch the color of the cropping rectangle between the primary and secondary colors. diff --git a/croptool.c b/croptool.c @@ -293,7 +293,10 @@ setup(int argc, char *argv[]) { state.cur_image = NULL; state.selections = malloc(argc * sizeof(struct Selection)); - if (!state.selections) exit(1); + if (!state.selections) { + fprintf(stderr, "Unable to allocate memory.\n"); + exit(1); + } state.num_files = argc; state.filenames = argv; state.cur_selection = -1; diff --git a/croptool_crop.1 b/croptool_crop.1 @@ -1,4 +1,4 @@ -.Dd March 6, 2021 +.Dd September 21, 2021 .Dt CROPTOOL_CROP 1 .Os .Sh NAME