Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert wand.image.Image to PIL.Image?

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.

like image 226
MGH Avatar asked Jan 02 '23 19:01

MGH


1 Answers

This doesn't involve numpy:

pil_image = PIL.Image.open(io.BytesIO(wand_image.make_blob("png"))
like image 164
formiga Avatar answered Jan 08 '23 11:01

formiga