return of shrink-less-affine-more

though a bit less extreme
This commit is contained in:
John Cupitt 2016-03-14 14:58:02 +00:00
parent 773b474116
commit ac4e5ce059
2 changed files with 29 additions and 8 deletions

View File

@ -115,11 +115,22 @@ vips_resize_build( VipsObject *object )
/* If the factor is > 1.0, we need to zoom rather than shrink.
* Just set the int part to 1 in this case.
*/
int_hshrink = resize->scale > 1.0 ?
1 : VIPS_FLOOR( 1.0 / resize->scale );
if( vips_object_argument_isset( object, "vscale" ) )
int_vshrink = resize->vscale > 1.0 ?
1 : VIPS_FLOOR( 1.0 / resize->vscale );
/* We want the int part of the shrink to leave a bit to do with
* blur/reduce/sharpen, or we'll see strange changes in aliasing on int
* shrink boundaries as we resize.
*/
if( resize->scale > 1.0 )
int_hshrink = 1;
else
int_hshrink = VIPS_FLOOR( 1.0 / (resize->scale * 1.1) );
if( vips_object_argument_isset( object, "vscale" ) ) {
if( resize->vscale > 1.0 )
int_vshrink = 1;
else
int_vshrink = VIPS_FLOOR( 1.0 / (resize->vscale * 1.1) );
}
else
int_vshrink = int_hshrink;

View File

@ -223,11 +223,21 @@ thumbnail_find_jpegshrink( VipsImage *im )
if( linear_processing )
return( 1 );
if( shrink >= 8 )
/* Shrink-on-load is a simple block shrink and will add quite a bit of
* extra sharpness to the image. We want to block shrink to a size a
* bit above our target, then anti-alias/downsample/sharpen to the
* target.
*
* For example, consider making a 400-pixel-across image from an
* 800-pixel image. If we load at 1/2 size, we could find ourselves
* doing no further processing, which would make a 400-px version look
* very different from a 450-px version.
*/
if( shrink >= 8.5 )
return( 8 );
else if( shrink >= 4 )
else if( shrink >= 4.5 )
return( 4 );
else if( shrink >= 2 )
else if( shrink >= 2.5 )
return( 2 );
else
return( 1 );