Closed steven-na closed 12 months ago
I've tried other combinations like
print(BytesIO(base64.b64decode(out)))
im = Image.open(BytesIO(base64.b64decode(out)))
im.show()
but i get the similar errors like:
Traceback (most recent call last):
File "C:\Programming\comfyuiapi\main.py", line 36, in <module>
a.get_images()
File "C:\Programming\comfyuiapi\api.py", line 44, in get_images
im = Image.open(BytesIO(base64.b64decode(out)))
File "C:\Users\blake\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\Image.py", line 3298, in open
raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001EBC8B4BA60>
I think you want
Image.open(BytesIO(data[s:]))
[s:]
strips the "event" and "format" codes, which don't belong to the imageI think you want
Image.open(BytesIO(data[s:]))
- The
[s:]
strips the "event" and "format" codes, which don't belong to the image- Don't use base64 - it's raw bytes of a PNG
Thank you very much, this worked
I'm trying to use the example provided in #2 but i don't get expected results,
The whole output from the WS looks like this: