mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-13 05:06:49 +03:00
extract band count check
This commit is contained in:
parent
e63ae380f1
commit
eee53ba664
|
@ -24,11 +24,11 @@ ImagingConvertMatrix(Imaging im, const char *mode, float m[]) {
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
|
|
||||||
/* Assume there's enough data in the buffer */
|
/* Assume there's enough data in the buffer */
|
||||||
if (!im) {
|
if (!im || im->bands != 3) {
|
||||||
return (Imaging)ImagingError_ModeError();
|
return (Imaging)ImagingError_ModeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(mode, "L") == 0 && im->bands == 3) {
|
if (strcmp(mode, "L") == 0) {
|
||||||
imOut = ImagingNewDirty("L", im->xsize, im->ysize);
|
imOut = ImagingNewDirty("L", im->xsize, im->ysize);
|
||||||
if (!imOut) {
|
if (!imOut) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -47,7 +47,7 @@ ImagingConvertMatrix(Imaging im, const char *mode, float m[]) {
|
||||||
}
|
}
|
||||||
ImagingSectionLeave(&cookie);
|
ImagingSectionLeave(&cookie);
|
||||||
|
|
||||||
} else if (strlen(mode) == 3 && im->bands == 3) {
|
} else if (strlen(mode) == 3) {
|
||||||
imOut = ImagingNewDirty(mode, im->xsize, im->ysize);
|
imOut = ImagingNewDirty(mode, im->xsize, im->ysize);
|
||||||
if (!imOut) {
|
if (!imOut) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user