From b665c2707555823ad607dbe00e49f940c2fc1b10 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 5 Jan 2019 15:28:59 -0500 Subject: [PATCH] Do not use virtual pixels if image dimensions evenly divisible by tile dimensions --- MagickCore/enhance.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index ba91ffeab..773b516b0 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -659,8 +659,12 @@ MagickExport MagickBooleanType CLAHEImage(Image *image,const size_t width, tile_info.height=height; if (tile_info.height == 0) tile_info.height=image->rows >> 3; - tile_info.x=(ssize_t) tile_info.width-(image->columns % tile_info.width); - tile_info.y=(ssize_t) tile_info.height-(image->rows % tile_info.height); + tile_info.x=0; + if ((image->columns % tile_info.width) != 0) + tile_info.x=(ssize_t) tile_info.width-(image->columns % tile_info.width); + tile_info.y=0; + if ((image->rows % tile_info.height) != 0) + tile_info.y=(ssize_t) tile_info.height-(image->rows % tile_info.height); clahe_info.width=image->columns+tile_info.x; clahe_info.height=image->rows+tile_info.y; clahe_info.x=(ssize_t) clahe_info.width/tile_info.width; -- 2.40.0