@ccc said
def ui2pil(ui_img):
with io.BytesIO(ui_img.to_png()) as mem_file:
return PILImage.open(mem_file.getvalue())
Not sure that your code works, doesn't PILImage.open need a path?
I know the reverse pil2ui
def pil2ui(imgIn): with io.BytesIO() as bIO: imgIn.save(bIO, 'PNG') imgOut = ui.Image.from_data(bIO.getvalue()) return imgOut