curio library provides async aopen()
function, while pillow has it's own Image.open
. I want to create thumbnail and suggest pillow is smart enough not to load all image into memory while creating thumbnail. It looks like this:
self.image = Image.open(path)
self.image.thumbnail((300, 300))
How this can be integrated with the curio library? For me it looks like I have two options:
aopen()
, load data into memory, then create Image
object from in-memory data and call Image.thumbnail()
Image.open()
async wrapping with async_thread
decorator, but it requires fire all thread machinery.Is there some better approach for integrating curio and pillow for this task?