Python image processing - without loading the entire image into memory

I am looking for a python library that will allow me to get image data from TIF images without loading the entire image into memory.

I tried to use numpy.memmap, but I could not find the image data in the file. Any advice would be helpful. Thank you

+3
source share
1 answer

I have two recommendations for you:

  • Read the image data in Python in chunks:

    with open('path/to/image-data.tif', 'rb') as tif:
        while True:
            chunk = tif.read(4096)
            if not chunk:
                break
    
  • Consider using NumExpr for your processing: https://github.com/pydata/numexpr

... , NumExpr , chunked-read, . NumPy, .

, , .

0