the underlying cause of getting the error message of Reason: "broken data stream when reading image file"

247 views
Skip to first unread message

wine lover

unread,
Jul 27, 2016, 10:59:58 PM7/27/16
to scikit-image
Hi, 

I am trying to test the skimage by running the following python script

from skimage import io
data = io.imread("./test_data/tiger.jpeg")
print(data.shape)

It gives the following error messages. What can be the reason? Thank you very much for the help.


bash-4.1$ python test.py

Traceback (most recent call last): File "/test/tfw/lib/python3.4/site-packages/scikit_image-0.12.3-py3.4-linux-x86_64.egg/skimage/io/_plugins/pil_plugin.py", line 53, in pil_to_ndarray im.getdata()[0] File "/test/tfw/lib/python3.4/site-packages/Pillow-3.2.0-py3.4-linux-x86_64.egg/PIL/Image.py", line 1151, in getdata File "/test/tfw/lib/python3.4/site-packages/Pillow-3.2.0-py3.4-linux-x86_64.egg/PIL/ImageFile.py", line 235, in load File "/test/tfw/lib/python3.4/site-packages/Pillow-3.2.0-py3.4-linux-x86_64.egg/PIL/ImageFile.py", line 59, in raise_ioerror OSError: broken data stream when reading image file

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "test.py", line 2, in data = io.imread("./test_data/tiger.jpeg") File "/test/tfw/lib/python3.4/site-packages/scikit_image-0.12.3-py3.4-linux-x86_64.egg/skimage/io/_io.py", line 61, in imread img = call_plugin('imread', fname, plugin=plugin, **plugin_args) File "/test/tfw/lib/python3.4/site-packages/scikit_image-0.12.3-py3.4-linux-x86_64.egg/skimage/io/manage_plugins.py", line 211, in call_plugin return func(*args, **kwargs) File "/test/tfw/lib/python3.4/site-packages/scikit_image-0.12.3-py3.4-linux-x86_64.egg/skimage/io/_plugins/pil_plugin.py", line 37, in imread return pil_to_ndarray(im, dtype=dtype, img_num=img_num) File "/test/tfw/lib/python3.4/site-packages/scikit_image-0.12.3-py3.4-linux-x86_64.egg/skimage/io/_plugins/pil_plugin.py", line 61, in pil_to_ndarray raise ValueError(error_message) ValueError: Could not load "" Reason: "broken data stream when reading image file" Please see documentation at:http://pillow.readthedocs.org/en/latest/installation.html#external-libraries

Stéfan van der Walt

unread,
Jul 28, 2016, 4:27:04 AM7/28/16
to scikit-image

Hi,

It sounds like the image might be corrupt. Can you load it using other image viewers? Also, did you try different plugins?

Stéfan


--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/fe62dc05-e818-4352-a236-3fb10593bc1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wine lover

unread,
Jul 28, 2016, 10:08:40 AM7/28/16
to scikit-image
Hi Stéfan,

The image itself could me opened and viewed using other viewers. Would you like to let me know what are the plugins you were referring to? I am new to skimage.  

Thanks.
Reply all
Reply to author
Forward
0 new messages