Skip to content Skip to sidebar Skip to footer

Read/open Image From Instance Of Python Io.bufferedreader Class

I'm struggling to properly open a TIFF image from an instance of Python's io.BufferedReader class. I download the image from a GCS path using the below lib, but I can't open seem

Solution 1:

Make sure you wrap both in a ContextManager so they both get closed properly.

with beam.io.gcp.gcsio.GcsIO().open(file_path, 'r') as file, Image.open(io.BytesIO(file.read())) as multi_page_tiff:
     do_stuff()

Post a Comment for "Read/open Image From Instance Of Python Io.bufferedreader Class"