more resize tuning
This commit is contained in:
parent
ac4e5ce059
commit
45c3fea6ac
@ -67,6 +67,7 @@ G_DEFINE_TYPE( VipsGaussblur, vips_gaussblur, VIPS_TYPE_OPERATION );
|
||||
static int
|
||||
vips_gaussblur_build( VipsObject *object )
|
||||
{
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
VipsGaussblur *gaussblur = (VipsGaussblur *) object;
|
||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 );
|
||||
|
||||
@ -84,6 +85,8 @@ vips_gaussblur_build( VipsObject *object )
|
||||
vips_matrixprint( t[0], NULL );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
vips_info( class->nickname, "gaussblur mask width %d", t[0]->Xsize );
|
||||
|
||||
if( vips_convsep( gaussblur->in, &t[1], t[0],
|
||||
"precision", gaussblur->precision,
|
||||
NULL ) )
|
||||
|
@ -124,12 +124,12 @@ vips_resize_build( VipsObject *object )
|
||||
if( resize->scale > 1.0 )
|
||||
int_hshrink = 1;
|
||||
else
|
||||
int_hshrink = VIPS_FLOOR( 1.0 / (resize->scale * 1.1) );
|
||||
int_hshrink = VIPS_FLOOR( 1.0 / (resize->scale * 1.4) );
|
||||
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) );
|
||||
int_vshrink = VIPS_FLOOR( 1.0 / (resize->vscale * 1.4) );
|
||||
}
|
||||
else
|
||||
int_vshrink = int_hshrink;
|
||||
@ -210,7 +210,7 @@ vips_resize_build( VipsObject *object )
|
||||
* Don't try to be clever for non-rectangular shrinks. We just
|
||||
* consider the horizontal factor.
|
||||
*/
|
||||
sigma = (1.0 / hresidual) / 2.3;
|
||||
sigma = (1.0 / hresidual) / 2.7;
|
||||
anti_alias = hresidual < 0.9 && sigma > 0.45;
|
||||
if( anti_alias ) {
|
||||
vips_info( class->nickname, "anti-alias sigma %g", sigma );
|
||||
@ -250,9 +250,9 @@ vips_resize_build( VipsObject *object )
|
||||
vips_info( class->nickname, "final sharpen" );
|
||||
t[4] = vips_image_new_matrixv( 3, 3,
|
||||
-1.0, -1.0, -1.0,
|
||||
-1.0, 32.0, -1.0,
|
||||
-1.0, 24.0, -1.0,
|
||||
-1.0, -1.0, -1.0 );
|
||||
vips_image_set_double( t[4], "scale", 24 );
|
||||
vips_image_set_double( t[4], "scale", 16 );
|
||||
|
||||
if( vips_conv( in, &t[5], t[4], NULL ) )
|
||||
return( -1 );
|
||||
|
@ -233,11 +233,11 @@ thumbnail_find_jpegshrink( VipsImage *im )
|
||||
* doing no further processing, which would make a 400-px version look
|
||||
* very different from a 450-px version.
|
||||
*/
|
||||
if( shrink >= 8.5 )
|
||||
if( shrink >= 9 )
|
||||
return( 8 );
|
||||
else if( shrink >= 4.5 )
|
||||
else if( shrink >= 5 )
|
||||
return( 4 );
|
||||
else if( shrink >= 2.5 )
|
||||
else if( shrink >= 3 )
|
||||
return( 2 );
|
||||
else
|
||||
return( 1 );
|
||||
|
Loading…
Reference in New Issue
Block a user