问题
I spent whole day on this problem and did not see answer in stack overflow!
I tried this but did not work:
>> pil_image = Image.frombytes('RGBA', wand_image.size, wand_image.make_blob(format='png'), 'raw')
ValueError: not enough image data
I appreciate every solution.
回答1:
This worked for me:
img_buffer = numpy.asarray(bytearray(wand_img.make_blob(format='png')), dtype='uint8')
bytesio = io.BytesIO(img_buffer)
pil_img = PIL.Image.open(bytesio)
来源:https://stackoverflow.com/questions/52536843/how-to-convert-wand-image-image-to-pil-image