Working in my enterprise context where we process large folders of ".tiff" files (>100k images), i found that usage of src/PIL/TiffImagePlugin.py still cause the well known error "Too many open files" due to memory storage i suppose is related to file handlers. (from stackoverflow posts)
I found a fast-fix for that by adding the following snippet of code to TiffImagePlugin.py :
if _fp:
try:
os.close(_fp)
except OSError:
pass
I propose to add this block after the if-else block in TiffImagePlugin.py like that:
if "_debug_multipage" in encoderinfo:
...
if _fp:
try:
os.close(_fp)
except OSError:
pass
I found this solution to correctly solve my issue empirically, avoiding "too many open files" error when working with large images directories.
PS:
I am a neophyte to github pull/branch/merge/commit system, so excuse me if i did not proposed the fix in the correct way. I just would like to help you, since Pillow is a very useful and lovely library.
Working in my enterprise context where we process large folders of ".tiff" files (>100k images), i found that usage of src/PIL/TiffImagePlugin.py still cause the well known error "Too many open files" due to memory storage i suppose is related to file handlers. (from stackoverflow posts)
I found a fast-fix for that by adding the following snippet of code to TiffImagePlugin.py :
I propose to add this block after the if-else block in TiffImagePlugin.py like that:
I found this solution to correctly solve my issue empirically, avoiding "too many open files" error when working with large images directories.
PS:
I am a neophyte to github pull/branch/merge/commit system, so excuse me if i did not proposed the fix in the correct way. I just would like to help you, since Pillow is a very useful and lovely library.