Reputation: 297
I've a huge TIF file of shape (39906, 30365, 4). I want to use it on PyQt5, however when I use PIL to open the image it gives the error "PIL.UnidentifiedImageError: cannot identify image file". I've searched and it seems that PIL can open TIF/TIFF files, but it has to be 8bit and my image is 8bit.
What could I do fix it? Is the file to large to be open by PIL? Is there another option to open a huge TIF to be used with PyQt5?
It's not necessary to open the whole image. Actually, if I could open a 25% scaled version of the original would be better.
Pillow version = 7.2.0
Upvotes: 1
Views: 1405
Reputation: 207465
If you are having issues handling very large images, consider using libvips
, either in your Python code or in the Terminal. It is very fast and frugal with memory.
Here's an example for Terminal:
vipsthumbnail BIGBOY.TIF --size 10000x -o small.tif # reduce width to 10000px
And see usingVIPSandShrink()
here.
Upvotes: 1