How to build a remote image (with http-url)

It should be easy, but I canโ€™t figure out how right now without using the urllib module and manually extracting the remote file

I want to overlay a graph with a deleted image (say, "http://matplotlib.sourceforge.net/_static/logo2.png"), and neither imshow() nor imread() can load the image.

Any ideas that will work will allow you to upload a remote image?

+7
source share
2 answers

Really easy:

 import urllib2 import matplotlib.pyplot as plt # create a file-like object from the url f = urllib2.urlopen("http://matplotlib.sourceforge.net/_static/logo2.png") # read the image file in a numpy array a = plt.imread(f) plt.imshow(a) plt.show() 
+9
source

This works for me in a notebook with python 3.5:

 from skimage import io import matplotlib.pyplot as plt image = io.imread(url) plt.imshow(image) plt.show() 
+3
source

All Articles