diff --git a/libvips/resample/reducev.cpp b/libvips/resample/reducev.cpp index fa965134..396069f2 100644 --- a/libvips/resample/reducev.cpp +++ b/libvips/resample/reducev.cpp @@ -653,10 +653,9 @@ vips_reducev_vector_gen( VipsRegion *out_region, void *vseq, #endif /*DEBUG_PIXELS*/ s.left = r->left; - s.top = r->top * reducev->vshrink; + s.top = r->top * reducev->vshrink - reducev->voffset; s.width = r->width; - s.height = r->height * reducev->vshrink + reducev->n_point - - reducev->voffset; + s.height = r->height * reducev->vshrink + reducev->n_point; if( vips_region_prepare( ir, &s ) ) return( -1 ); diff --git a/test/test-suite/test_resample.py b/test/test-suite/test_resample.py index 6453d62e..04c81580 100644 --- a/test/test-suite/test_resample.py +++ b/test/test-suite/test_resample.py @@ -82,9 +82,8 @@ class TestResample: for fac in [1, 1.1, 1.5, 1.999]: for fmt in all_formats: - # TODO: Add nearest kernel when https://github.com/libvips/libvips/issues/1518 is done. - # (running the test suite with VIPS_NOVECTOR=1 should also work) - for kernel in ["linear", "cubic", "lanczos2", "lanczos3"]: + for kernel in ["nearest", "linear", + "cubic", "lanczos2", "lanczos3"]: x = im.cast(fmt) r = x.reduce(fac, fac, kernel=kernel) d = abs(r.avg() - im.avg())