I am coming into a scenario that I need to use python pillow to read image from a given list of byte chunks (e.g., an iterator with type Iterator[bytes]), then save it to a location.
I hope I could come up with a method like this:
def save_image(chunks: Iterator[bytes]):
pil_image: Image = Image.open(chunks) # Here is where I am getting blocked
# ... some image operations
pil_image.save(SOME_PATH, format=pil_image.format)
But it seems that I didn't find any documents or other questions that can resolve my question, to allow python pillow to read images from a list of byte chunks. Any help would be really appreciated, thanks!