fix thumbnail with small plus crop plus no upsize
thumbnail could fail for small images if upsize was disallowed and crop was enabled, thanks Andrewsville see https://github.com/libvips/libvips/issues/2157
This commit is contained in:
parent
dd4b11063a
commit
2041f228f5
@ -1,6 +1,7 @@
|
||||
14/6/21 started 8.12
|
||||
- all tools support `--version`
|
||||
- add vips_svgload_string() convenience function
|
||||
- fix thumbnail with small image plus crop plus no upsize [Andrewsville]
|
||||
|
||||
14/7/21 started 8.11.3
|
||||
- build threadpool later [kleisauke]
|
||||
|
@ -928,8 +928,13 @@ vips_thumbnail_build( VipsObject *object )
|
||||
/* Crop after rotate so we don't need to rotate the crop box.
|
||||
*/
|
||||
if( thumbnail->crop != VIPS_INTERESTING_NONE ) {
|
||||
g_info( "cropping to %dx%d",
|
||||
thumbnail->width, thumbnail->height );
|
||||
/* The image can be smaller than the target. Adjust the
|
||||
* arguments to vips_smartcrop().
|
||||
*/
|
||||
int crop_width = VIPS_MIN( thumbnail->width, in->Xsize );
|
||||
int crop_height = VIPS_MIN( thumbnail->height, in->Ysize );
|
||||
|
||||
g_info( "cropping to %dx%d", crop_width, crop_height );
|
||||
|
||||
/* Need to copy to memory, we have to stay seq.
|
||||
*
|
||||
@ -937,7 +942,7 @@ vips_thumbnail_build( VipsObject *object )
|
||||
*/
|
||||
if( !(t[8] = vips_image_copy_memory( in )) ||
|
||||
vips_smartcrop( t[8], &t[11],
|
||||
thumbnail->width, thumbnail->height,
|
||||
crop_width, crop_height,
|
||||
"interesting", thumbnail->crop,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user