Transform 'LazyMedia' object to (PIL) image

I’m pretty sure PIL will take a file like object (which you can create in such a way as to keep the image in memory like you require).

Something Like:

import io

file_obj = io.BytesIO( lazymedia_object.get_bytes() )
PIL_image_obj = PIL.Image.open( file_obj )

Here’s a link where we did something similar with pandas:

1 Like