Fix incorrect image type checking in _imagingmorph module

This commit is contained in:
Alexander 2018-03-25 12:54:13 +03:00
parent 9386a414fc
commit f826dc37d1

View File

@ -64,12 +64,12 @@ apply(PyObject *self, PyObject* args)
width = imgin->xsize;
height = imgin->ysize;
if (imgin->type != IMAGING_TYPE_UINT8 &&
if (imgin->type != IMAGING_TYPE_UINT8 ||
imgin->bands != 1) {
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
return NULL;
}
if (imgout->type != IMAGING_TYPE_UINT8 &&
if (imgout->type != IMAGING_TYPE_UINT8 ||
imgout->bands != 1) {
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
return NULL;
@ -167,7 +167,7 @@ match(PyObject *self, PyObject* args)
lut = PyBytes_AsString(py_lut);
imgin = (Imaging) i0;
if (imgin->type != IMAGING_TYPE_UINT8 &&
if (imgin->type != IMAGING_TYPE_UINT8 ||
imgin->bands != 1) {
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
return NULL;