We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66ff15a commit 55ba612Copy full SHA for 55ba612
lib/matplotlib/image.py
@@ -1473,7 +1473,11 @@ def imread(fname, format=None):
1473
parsed = urllib.parse.urlparse(fname)
1474
if len(parsed.scheme) > 1: # Pillow doesn't handle URLs directly.
1475
with urllib.request.urlopen(fname) as response:
1476
- return imread(BytesIO(response.read()), format=ext)
+ try:
1477
+ response.seek(0)
1478
+ except (AttributeError, io.UnsupportedOperation):
1479
+ response = BytesIO(response.read())
1480
+ return imread(response, format=ext)
1481
with img_open(fname) as image:
1482
return (_pil_png_to_float_array(image)
1483
if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
0 commit comments