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 02fc6a1 commit 9e42b9fCopy full SHA for 9e42b9f
nibabel/filebasedimages.py
@@ -574,3 +574,13 @@ def to_bytes(self, **kwargs):
574
file_map = self.make_file_map({'image': bio, 'header': bio})
575
self.to_file_map(file_map, **kwargs)
576
return bio.getvalue()
577
+
578
+ @classmethod
579
+ def from_url(klass, url):
580
+ """ Fetch image from remote location and construct an image
581
582
+ Requires the ``requests`` library to be installed.
583
+ """
584
+ import requests
585
+ res = requests.get(url)
586
+ return klass.from_bytes(res.content)
0 commit comments