diff --git a/ChangeLog b/ChangeLog index 96759975..fd154a09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 21/11/18 started 8.7.3 - fix infinite loop for autofit with non-scaleable font - mapim was not offsetting by window offset [erdmann] +- better rounding for scale [kleisauke] 21/11/18 started 8.7.2 - more info output for temp files to help diagnose problems diff --git a/libvips/conversion/scale.c b/libvips/conversion/scale.c index 5499eb78..eb745b21 100644 --- a/libvips/conversion/scale.c +++ b/libvips/conversion/scale.c @@ -22,6 +22,8 @@ * - use linear uchar mode * 14/7/14 * - round to nearest on uchar output + * 29/12/18 kleisauke + * - ... and round to nearest in log mode too */ /* @@ -111,7 +113,9 @@ vips_scale_build( VipsObject *object ) if( vips_pow_const1( scale->in, &t[2], scale->exp, NULL ) || vips_linear1( t[2], &t[3], 1.0, 1.0, NULL ) || vips_log10( t[3], &t[4], NULL ) || - vips_linear1( t[4], &t[5], f, 0.0, + /* Add 0.5 to get round to nearest. + */ + vips_linear1( t[4], &t[5], f, 0.5, "uchar", TRUE, NULL ) || vips_image_write( t[5], conversion->out ) )