add all
smartcrop mode
So you can crop to fill as well as crop to fit. see https://github.com/libvips/libvips/issues/1583
This commit is contained in:
parent
3b57e13452
commit
834234c23c
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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().
|
||||
*
|
||||
|
@ -101,6 +101,7 @@ typedef enum {
|
||||
VIPS_INTERESTING_ATTENTION,
|
||||
VIPS_INTERESTING_LOW,
|
||||
VIPS_INTERESTING_HIGH,
|
||||
VIPS_INTERESTING_ALL,
|
||||
VIPS_INTERESTING_LAST
|
||||
} VipsInteresting;
|
||||
|
||||
|
@ -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}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user