PIL.UnidentifiedImageError: cannot identify image file
Operating system
Ubuntu
Platform
64-bit x86
OpenSlide Python version
1.3.1
OpenSlide version
3.4.1
Slide format
svs
Issue details
when I read other SVS files, I can read them normally, within 2GB of SVS files. Today, there was a read error while reading an SVS file with a file size of 4GB. Does Openslide not support reading such a large SVS file?
I'm getting this error when trying to read the test.svs file. I tested openslide-python installed through both pip and conda.
import openslide
slide = openslide.open_slide(r'test.svs')
Traceback (most recent call last):
File "/home/testa.py", line 3, in
It may be a file issue, I will temporarily close the issue.
openslide.open_slide() falls back to PIL.Image if OpenSlide can't read the file, obscuring the original error message. If you open the file with openslide.OpenSlide() instead, you'll get an exception with OpenSlide's original error.
It's possible that OpenSlide has trouble with large SVS files. If you can submit a sample slide that shows the problem, I can take a look at it.
openslide.open_slide()falls back toPIL.Imageif OpenSlide can't read the file, obscuring the original error message. If you open the file withopenslide.OpenSlide()instead, you'll get an exception with OpenSlide's original error.It's possible that OpenSlide has trouble with large SVS files. If you can submit a sample slide that shows the problem, I can take a look at it.
I'm very sorry for replying to you only now. After inquiry, I found out that this is a private dataset of the hospital, and they do not agree to share it externally. So I cannot upload. I checked those SVS files again and found that some of them were incorrect, so I deleted those images. In addition, I found that for SVS that occupies a large amount of memory (currently 4GB for me), When the ### open_ slide() method is used for reading, the following error will be displayed: Image size (14393580812 pixels) exceeds limit of 178956970 pixels, could be decompression Bomb DOS attack, May I ask if you have a good solution.
Please try opening the slide with openslide.OpenSlide() and report the error you receive.
Please try opening the slide with
openslide.OpenSlide()and report the error you receive.
The following is using Openslide Error message for OpenSlide():
Traceback (most recent call last):
File "/home/testa.py", line 5, in
The following is using open_ Error message for slide(): Traceback (most recent call last): File "/home/anaconda3/envs/torch11.6/lib/python3.8/site-packages/openslide/init.py", line 463, in open_slide return OpenSlide(filename) File "/home/anaconda3/envs/torch11.6/lib/python3.8/site-packages/openslide/init.py", line 179, in init self._osr = lowlevel.open(str(filename)) File "/home/anaconda3/envs/torch11.6/lib/python3.8/site-packages/openslide/lowlevel.py", line 203, in _check_open raise OpenSlideUnsupportedFormatError("Unsupported or missing image file") openslide.lowlevel.OpenSlideUnsupportedFormatError: Unsupported or missing image file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/testa.py", line 5, in
Hmm, okay. Could you try setting the OPENSLIDE_DEBUG environment variable to detection? That'll report the reason that each OpenSlide driver is rejecting the file. You can do this when starting Python with:
OPENSLIDE_DEBUG=detection python3
From the error message, it appears that OpenSlide doesn't think it supports these slide files. Without additional information, I can't debug this further, so I'll close. If you're able to provide additional information, please feel free to post it here or file a new bug in the OpenSlide issue tracker.