Try removing the .
before the .bmp
(it isn't matching BMP
as expected). As you can see from the error, the save_handler
is upper-casing the format
you provided and then looking for a match in SAVE
. However the corresponding key in that object is BMP
(instead of .BMP
).
I don't know a great deal about PIL
, but from some quick searching around it seems that it is a problem with the mode
of the image. Changing the definition of j
to:
j = Image.fromarray(b, mode='RGB')
Seemed to work for me (however note that I have very little knowledge of PIL
, so I would suggest using @mmgp's solution as s/he clearly knows what they are doing :) ). For the types of mode
, I used this page - hopefully one of the choices there will work for you.