diff --git a/ChangeLog b/ChangeLog index eb0acca2..67c73ecc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 21/9/18 started 8.8.0 +- much faster smartcrop [lovell] +- add low/high to smartcrop [jcupitt] 23/9/18 started 8.7.1 - update function list in docs [janko-m] diff --git a/libvips/conversion/smartcrop.c b/libvips/conversion/smartcrop.c index 61e4445e..65a2d6bd 100644 --- a/libvips/conversion/smartcrop.c +++ b/libvips/conversion/smartcrop.c @@ -8,6 +8,10 @@ * - revised attention smartcrop * 8/6/17 * - revised again + * 15/9/18 lovell + * - move shrink to start of processing + * 22/9/18 jcupitt + * - add low and high */ /* @@ -352,6 +356,16 @@ vips_smartcrop_build( VipsObject *object ) return( -1 ); break; + case VIPS_INTERESTING_LOW: + left = 0; + top = 0; + break; + + case VIPS_INTERESTING_HIGH: + left = smartcrop->in->Xsize - smartcrop->width; + top = smartcrop->in->Ysize - smartcrop->height; + break; + default: g_assert_not_reached(); diff --git a/libvips/include/vips/conversion.h b/libvips/include/vips/conversion.h index a466182d..eaa7ff22 100644 --- a/libvips/include/vips/conversion.h +++ b/libvips/include/vips/conversion.h @@ -99,6 +99,8 @@ typedef enum { VIPS_INTERESTING_CENTRE, VIPS_INTERESTING_ENTROPY, VIPS_INTERESTING_ATTENTION, + VIPS_INTERESTING_LOW, + VIPS_INTERESTING_HIGH, VIPS_INTERESTING_LAST } VipsInteresting; diff --git a/libvips/iofuncs/enumtypes.c b/libvips/iofuncs/enumtypes.c index f633b27b..0db48abc 100644 --- a/libvips/iofuncs/enumtypes.c +++ b/libvips/iofuncs/enumtypes.c @@ -364,6 +364,8 @@ vips_interesting_get_type( void ) {VIPS_INTERESTING_CENTRE, "VIPS_INTERESTING_CENTRE", "centre"}, {VIPS_INTERESTING_ENTROPY, "VIPS_INTERESTING_ENTROPY", "entropy"}, {VIPS_INTERESTING_ATTENTION, "VIPS_INTERESTING_ATTENTION", "attention"}, + {VIPS_INTERESTING_LOW, "VIPS_INTERESTING_LOW", "low"}, + {VIPS_INTERESTING_HIGH, "VIPS_INTERESTING_HIGH", "high"}, {VIPS_INTERESTING_LAST, "VIPS_INTERESTING_LAST", "last"}, {0, NULL, NULL} };