From 001bee40ab42373cb3d120f6b7143d2b39aabff3 Mon Sep 17 00:00:00 2001 From: Pierrick Koch Date: Wed, 27 Apr 2016 15:23:44 +0200 Subject: [PATCH] [PIL] Image add support fromarray LA mode fix: >>> img = np.zeros((40,40,2), 'uint8') >>> Image.fromarray(img) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1929, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type --- PIL/Image.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PIL/Image.py b/PIL/Image.py index c0515d378..136f5134c 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -2215,6 +2215,7 @@ _fromarray_typemap = { ((1, 1), ">f4"): ("F", "F;32BF"), ((1, 1), "f8"): ("F", "F;64BF"), + ((1, 1, 2), "|u1"): ("LA", "LA"), ((1, 1, 3), "|u1"): ("RGB", "RGB"), ((1, 1, 4), "|u1"): ("RGBA", "RGBA"), }