From 285ab2e6ccd3bcc04db4ada3ecc59581c780d7b3 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 31 Aug 2020 13:37:08 +0100 Subject: [PATCH] better mask sizing for gaussmat We were calculating the mask size incorrectly for small masks. Thanks johntrunc see https://github.com/libvips/libvips/issues/1793 --- ChangeLog | 1 + libvips/create/gaussmat.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4221e5ad..70926961 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ - stop 0-length buffer being passed to imagemagick [lovell] - convert no-profile CMYK to RGB on save [augustocdias] - ensure SVG loader skips input with chars outside x09-x7F range [lovell] +- better mask sizing in gaussmat [johntrunc] 24/1/20 started 8.10.0 - more conformat IIIF output from dzsave [regisrob] diff --git a/libvips/create/gaussmat.c b/libvips/create/gaussmat.c index 4ac21562..a18d1816 100644 --- a/libvips/create/gaussmat.c +++ b/libvips/create/gaussmat.c @@ -129,7 +129,7 @@ vips_gaussmat_build( VipsObject *object ) vips_error( class->nickname, "%s", _( "mask too large" ) ); return( -1 ); } - width = 2 * x - 1; + width = 2 * VIPS_MAX( x - 1, 0 ) + 1; height = gaussmat->separable ? 1 : width; vips_image_init_fields( create->out,