vips_scale() needs round to nearest
or we can get rounding errors in some cases
This commit is contained in:
parent
91eeeafa05
commit
388f25fc0c
@ -1,6 +1,7 @@
|
|||||||
4/7/14 started 7.40.4
|
4/7/14 started 7.40.4
|
||||||
- fix vips_rawsave_fd(), thanks aferrero2707
|
- fix vips_rawsave_fd(), thanks aferrero2707
|
||||||
- fix im_point()
|
- fix im_point()
|
||||||
|
- vips_scale() now does round to nearest to avoid rounding errors
|
||||||
|
|
||||||
30/6/14 started 7.40.3
|
30/6/14 started 7.40.3
|
||||||
- fix interlaced thumbnails in vipsthumbnail, thanks lovell
|
- fix interlaced thumbnails in vipsthumbnail, thanks lovell
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
* - add log scale and exponent as an option
|
* - add log scale and exponent as an option
|
||||||
* 14/1/14
|
* 14/1/14
|
||||||
* - use linear uchar mode
|
* - use linear uchar mode
|
||||||
|
* 14/7/14
|
||||||
|
* - round to nearest on uchar output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -117,7 +119,10 @@ vips_scale_build( VipsObject *object )
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
double f = 255.0 / (mx - mn);
|
double f = 255.0 / (mx - mn);
|
||||||
double a = -(mn * f);
|
|
||||||
|
/* Add .5 to get round-to-nearest.
|
||||||
|
*/
|
||||||
|
double a = -(mn * f) + 0.5;
|
||||||
|
|
||||||
if( vips_linear1( scale->in, &t[2], f, a,
|
if( vips_linear1( scale->in, &t[2], f, a,
|
||||||
"uchar", TRUE,
|
"uchar", TRUE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user