better rounding in resize

This commit is contained in:
John Cupitt 2016-03-12 13:14:34 +00:00
parent 493482c8a7
commit 70db9aa77b
2 changed files with 10 additions and 5 deletions

7
TODO
View File

@ -4,7 +4,12 @@
- try orc version of reducev?
- still see rounding problems on resize, try ghibli3
- try
$ vipsthumbnail ghibli_orig.jpg -s 600x1085
$ vipsheader tn_ghibli_orig.jpg
tn_ghibli_orig.jpg: 599x1083 uchar, 3 bands, srgb, jpegload

View File

@ -136,12 +136,12 @@ vips_resize_build( VipsObject *object )
* between our target size and the size we have after vips_shrink().
*
* Aim for a little above target so we can't round down below it.
*
* This can break the aspect ratio slightly :/ but hopefully no one
* will notice.
*/
hresidual = ((double) target_width + 0.1) / in->Xsize;
if( vips_object_argument_isset( object, "vscale" ) )
vresidual = ((double) target_height + 0.1) / in->Ysize;
else
vresidual = hresidual;
vresidual = ((double) target_height + 0.1) / in->Ysize;
/* We want to make sure we read the image sequentially.
* However, the convolution we may be doing later will force us