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:
- Call
aopen(), load data into memory, then createImageobject from in-memory data and callImage.thumbnail() - Make
Image.open()async wrapping withasync_threaddecorator, but it requires fire all thread machinery.
Is there some better approach for integrating curio and pillow for this task?