HI, is it possible that I created a image from matplotlib and I save it on an image object I created from PIL? Sounds very hard? Who can help me?
I was having the same question and I stumbled upon this answer. Just wanted to add to the above answer that PIL.Image.fromstring
has been deprecated and frombytes should be used now instead of fromstring. Hence, we should modify line:
pil_image = PIL.Image.fromstring('RGB', canvas.get_width_height(),
canvas.tostring_rgb())
to
pil_image = PIL.Image.frombytes('RGB', canvas.get_width_height(),
canvas.tostring_rgb())