Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,7 @@ getpixel(Imaging im, ImagingAccess access, int x, int y) {
case IMAGING_TYPE_FLOAT32:
return PyFloat_FromDouble(pixel.f);
case IMAGING_TYPE_SPECIAL:
if (im->bands == 1) {
return PyLong_FromLong(pixel.h);
} else {
return Py_BuildValue("BBB", pixel.b[0], pixel.b[1], pixel.b[2]);
}
break;
return PyLong_FromLong(pixel.h);
}

/* unknown type */
Expand Down Expand Up @@ -665,26 +660,10 @@ getink(PyObject *color, Imaging im, char *ink) {
memcpy(ink, &ftmp, sizeof(ftmp));
return ink;
case IMAGING_TYPE_SPECIAL:
if (isModeI16(im->mode)) {
ink[0] = (UINT8)r;
ink[1] = (UINT8)(r >> 8);
ink[2] = ink[3] = 0;
return ink;
} else {
if (rIsInt) {
b = (UINT8)(r >> 16);
g = (UINT8)(r >> 8);
r = (UINT8)r;
} else if (tupleSize != 3) {
PyErr_SetString(
PyExc_TypeError,
"color must be int, or tuple of one or three elements"
);
return NULL;
} else if (!PyArg_ParseTuple(color, "iiL", &b, &g, &r)) {
return NULL;
}
}
ink[0] = (UINT8)r;
ink[1] = (UINT8)(r >> 8);
ink[2] = ink[3] = 0;
return ink;
}

PyErr_SetString(PyExc_ValueError, wrong_mode);
Expand Down
9 changes: 1 addition & 8 deletions src/libImaging/Geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 +714,7 @@ getfilter(Imaging im, int filterid) {
case IMAGING_TYPE_UINT8:
return nearest_filter8;
case IMAGING_TYPE_SPECIAL:
switch (im->pixelsize) {
case 1:
return nearest_filter8;
case 2:
return nearest_filter16;
case 4:
return nearest_filter32;
}
return nearest_filter16;
}
} else {
return nearest_filter32;
Expand Down
Loading