diff --git a/_imaging.c b/_imaging.c index 730f132ed..2c60407d2 100644 --- a/_imaging.c +++ b/_imaging.c @@ -1819,7 +1819,7 @@ _box_blur(ImagingObject* self, PyObject* args) if (!imOut) return NULL; - if (!ImagingBoxBlur(imIn, imOut, radius, n)) + if (!ImagingBoxBlur(imOut, imIn, radius, n)) return NULL; return PyImagingNew(imOut); diff --git a/libImaging/BoxBlur.c b/libImaging/BoxBlur.c index 8be9c77d3..a0e23c4cd 100644 --- a/libImaging/BoxBlur.c +++ b/libImaging/BoxBlur.c @@ -232,7 +232,7 @@ HorizontalBoxBlur(Imaging im, Imaging imOut, float floatRadius) Imaging -ImagingBoxBlur(Imaging im, Imaging imOut, float radius, int n) +ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n) { int i; @@ -242,32 +242,32 @@ ImagingBoxBlur(Imaging im, Imaging imOut, float radius, int n) ); } - if (strcmp(im->mode, imOut->mode) || - im->type != imOut->type || - im->bands != imOut->bands || - im->xsize != imOut->xsize || - im->ysize != imOut->ysize) + if (strcmp(imIn->mode, imOut->mode) || + imIn->type != imOut->type || + imIn->bands != imOut->bands || + imIn->xsize != imOut->xsize || + imIn->ysize != imOut->ysize) return ImagingError_Mismatch(); - if (im->type != IMAGING_TYPE_UINT8) + if (imIn->type != IMAGING_TYPE_UINT8) return ImagingError_ModeError(); - if ( ! (strcmp(im->mode, "RGB") == 0 || - strcmp(im->mode, "RGBA") == 0 || - strcmp(im->mode, "RGBX") == 0 || - strcmp(im->mode, "CMYK") == 0 || - strcmp(im->mode, "L") == 0 || - strcmp(im->mode, "LA") == 0)) + if ( ! (strcmp(imIn->mode, "RGB") == 0 || + strcmp(imIn->mode, "RGBA") == 0 || + strcmp(imIn->mode, "RGBX") == 0 || + strcmp(imIn->mode, "CMYK") == 0 || + strcmp(imIn->mode, "L") == 0 || + strcmp(imIn->mode, "LA") == 0)) return ImagingError_ModeError(); - /* Create transposed temp image (im->ysize x im->xsize). */ - Imaging temp = ImagingNew(im->mode, im->ysize, im->xsize); + /* Create transposed temp image (imIn->ysize x imIn->xsize). */ + Imaging temp = ImagingNew(imIn->mode, imIn->ysize, imIn->xsize); if ( ! temp) return NULL; /* Apply one-dimensional blur. HorizontalBoxBlur transposes image at same time. */ - HorizontalBoxBlur(im, imOut, radius); + HorizontalBoxBlur(imIn, imOut, radius); for (i = 1; i < n; i ++) { HorizontalBoxBlur(imOut, imOut, radius); } diff --git a/libImaging/Imaging.h b/libImaging/Imaging.h index 8b3ce1b81..130975982 100644 --- a/libImaging/Imaging.h +++ b/libImaging/Imaging.h @@ -309,7 +309,7 @@ extern Imaging ImagingTransform( int fill); extern Imaging ImagingUnsharpMask( Imaging im, Imaging imOut, float radius, int percent, int threshold); -extern Imaging ImagingBoxBlur(Imaging im, Imaging imOut, float radius, int n); +extern Imaging ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n); extern Imaging ImagingCopy2(Imaging imOut, Imaging imIn); extern Imaging ImagingConvert2(Imaging imOut, Imaging imIn);