py360convert icon indicating copy to clipboard operation
py360convert copied to clipboard

Problem with Py360Convert and Pillow

Open xXxjubeixXx opened this issue 2 years ago • 1 comments

When I play the code on Python it gives me this error and I think it is a problem with PIL

/bin/python3 "/home/jubei/Documentos/Python/Images 360/equiretangular.py"
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2813, in fromarray
    mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 3), '<f8')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jubei/Documentos/Python/Images 360/equiretangular.py", line 9, in <module>
    image = Image.fromarray(equiretangular)
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 2815, in fromarray
    raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 3), <f8

xXxjubeixXx avatar Mar 24 '23 22:03 xXxjubeixXx

you need to convert the image to unint8

equirec = np.clip(equirec, 0, 255).astype(np.uint8)

PerrinAntonin avatar Apr 13 '23 12:04 PerrinAntonin