You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the method Image.open(tiff_filename).load() to read a tiff file from a SMB server.
What did you expect to happen?
25MB data is read from the server during reading.
What actually happened?
It is very slow and downloads hundreds megabytes of data.
Currently, I change to reading the content into memory first and adding a BytesIO wrapper. raw = f.read(); Image.open(BytesIO(raw)).load()
This can gives me the same result and the speed and network traffic is expected.
My findings
The tiff file is a ~5000x5000 8bit image with no compression. The library first loads the header and gets the data of ~5000 tiles. As the offsets in the tiles list show, each tile has 5KB size. However, pillow reads a much larger size for each tile, which is a const MAXBLOCK = 65536 (bytes) = ~65KB.
Thanks for the reminder! I should have it uploaded at first... IMG07.zip
These tiff files are the output of some industrial camera and the one I upload here is simply some noise. I need to zip it since GitHub do not like tiff files in comment.
What did you do?
I use the method
Image.open(tiff_filename).load()
to read a tiff file from a SMB server.What did you expect to happen?
25MB data is read from the server during reading.
What actually happened?
It is very slow and downloads hundreds megabytes of data.
Currently, I change to reading the content into memory first and adding a BytesIO wrapper.
raw = f.read(); Image.open(BytesIO(raw)).load()
This can gives me the same result and the speed and network traffic is expected.
My findings
The tiff file is a ~5000x5000 8bit image with no compression. The library first loads the header and gets the data of ~5000 tiles. As the offsets in the tiles list show, each tile has 5KB size. However, pillow reads a much larger size for each tile, which is a const
MAXBLOCK = 65536 (bytes) = ~65KB
.Pillow/src/PIL/ImageFile.py
Line 280 in 76919ad
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: