From 5b7f6f2638216d85da31586601d6821b451b3377 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 15 Sep 2015 01:00:36 -0700 Subject: [PATCH 1/2] Fix docs to match code, see http://engineering.khanacademy.org/posts/making-thumbnails-fast.htm --- PIL/Image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/Image.py b/PIL/Image.py index 0f11ad7a9..4a23c56c3 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -822,7 +822,7 @@ class Image(object): :param mode: The requested mode. See: :ref:`concept-modes`. :param matrix: An optional conversion matrix. If given, this - should be 4- or 16-tuple containing floating point values. + should be 4- or 12-tuple containing floating point values. :param dither: Dithering method, used when converting from mode "RGB" to "P" or from "RGB" or "L" to "1". Available methods are NONE or FLOYDSTEINBERG (default). From 4cd29c10d396aad32a02e89895a6c8a4e1a31491 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 15 Sep 2015 01:01:04 -0700 Subject: [PATCH 2/2] Fix indentation to match actual code flow --- _imaging.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/_imaging.c b/_imaging.c index e49c5431f..92dfc005e 100644 --- a/_imaging.c +++ b/_imaging.c @@ -768,11 +768,12 @@ _convert_matrix(ImagingObject* self, PyObject* args) float m[12]; if (!PyArg_ParseTuple(args, "s(ffff)", &mode, m+0, m+1, m+2, m+3)) { PyErr_Clear(); - if (!PyArg_ParseTuple(args, "s(ffffffffffff)", &mode, - m+0, m+1, m+2, m+3, - m+4, m+5, m+6, m+7, - m+8, m+9, m+10, m+11)) - return NULL; + if (!PyArg_ParseTuple(args, "s(ffffffffffff)", &mode, + m+0, m+1, m+2, m+3, + m+4, m+5, m+6, m+7, + m+8, m+9, m+10, m+11)){ + return NULL; + } } return PyImagingNew(ImagingConvertMatrix(self->image, mode, m));