diff --git a/ChangeLog b/ChangeLog index 7c7ae490..57d95715 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ - add subsample_mode, deprecate no_subsample in jpegsave [Elad-Laufer] - add vips_isdirf() - add PAGENUMBER support to tiff write [jclavoie-jive] +- add all to smartcrop 31/1/19 started 8.9.2 - fix a deadlock with --vips-leak [DarthSim] diff --git a/libvips/conversion/conversion.c b/libvips/conversion/conversion.c index 51dcfb97..66a2f87f 100644 --- a/libvips/conversion/conversion.c +++ b/libvips/conversion/conversion.c @@ -214,6 +214,7 @@ * @VIPS_INTERESTING_ATTENTION: look for features likely to draw human attention * @VIPS_INTERESTING_LOW: position the crop towards the low coordinate * @VIPS_INTERESTING_HIGH: position the crop towards the high coordinate + * @VIPS_INTERESTING_ALL: everything is interesting * * Pick the algorithm vips uses to decide image "interestingness". This is used * by vips_smartcrop(), for example, to decide what parts of the image to diff --git a/libvips/conversion/smartcrop.c b/libvips/conversion/smartcrop.c index 2d83954c..c156fa73 100644 --- a/libvips/conversion/smartcrop.c +++ b/libvips/conversion/smartcrop.c @@ -12,6 +12,8 @@ * - move shrink to start of processing * 22/9/18 jcupitt * - add low and high + * 19/3/20 jcupitt + * - add all */ /* @@ -345,8 +347,8 @@ vips_smartcrop_build( VipsObject *object ) break; case VIPS_INTERESTING_CENTRE: - left = (smartcrop->in->Xsize - smartcrop->width) / 2; - top = (smartcrop->in->Ysize - smartcrop->height) / 2; + left = (in->Xsize - smartcrop->width) / 2; + top = (in->Ysize - smartcrop->height) / 2; break; case VIPS_INTERESTING_ENTROPY: @@ -360,8 +362,15 @@ vips_smartcrop_build( VipsObject *object ) break; case VIPS_INTERESTING_HIGH: - left = smartcrop->in->Xsize - smartcrop->width; - top = smartcrop->in->Ysize - smartcrop->height; + left = in->Xsize - smartcrop->width; + top = in->Ysize - smartcrop->height; + break; + + case VIPS_INTERESTING_ALL: + left = 0; + top = 0; + smartcrop->width = in->Xsize; + smartcrop->height = in->Ysize; break; default: @@ -448,10 +457,10 @@ vips_smartcrop_init( VipsSmartcrop *smartcrop ) * Crop an image down to a specified width and height by removing boring parts. * * Use @interesting to pick the method vips uses to decide which bits of the - * image should be kept. + * image should be kept. * * You can test xoffset / yoffset on @out to find the location of the crop - * within the input image. + * within the input image. * * See also: vips_extract_area(). * diff --git a/libvips/include/vips/conversion.h b/libvips/include/vips/conversion.h index 109b456e..86643e9f 100644 --- a/libvips/include/vips/conversion.h +++ b/libvips/include/vips/conversion.h @@ -101,6 +101,7 @@ typedef enum { VIPS_INTERESTING_ATTENTION, VIPS_INTERESTING_LOW, VIPS_INTERESTING_HIGH, + VIPS_INTERESTING_ALL, VIPS_INTERESTING_LAST } VipsInteresting; diff --git a/libvips/iofuncs/enumtypes.c b/libvips/iofuncs/enumtypes.c index 8a748a7d..a4adbe30 100644 --- a/libvips/iofuncs/enumtypes.c +++ b/libvips/iofuncs/enumtypes.c @@ -366,6 +366,7 @@ vips_interesting_get_type( void ) {VIPS_INTERESTING_ATTENTION, "VIPS_INTERESTING_ATTENTION", "attention"}, {VIPS_INTERESTING_LOW, "VIPS_INTERESTING_LOW", "low"}, {VIPS_INTERESTING_HIGH, "VIPS_INTERESTING_HIGH", "high"}, + {VIPS_INTERESTING_ALL, "VIPS_INTERESTING_ALL", "all"}, {VIPS_INTERESTING_LAST, "VIPS_INTERESTING_LAST", "last"}, {0, NULL, NULL} };