Python

In [1]:
import matplotlib.image as mpimg
import urllib2 as urllib
import io
fd = urllib.urlopen("http://mindey.com/wamh.jpg")
image_file = io.BytesIO(fd.read())
img=mpimg.imread(image_file, format='jpg')
In [2]:
imgplot = plt.imshow(img[:,:,0])

R

In [3]:
%%R
library(jpeg)
myurl <- "http://mindey.com/wamh.jpg"
z <- tempfile()
download.file(myurl,z,mode="wb")
pic <- readJPEG(z)
file.remove(z)
trying URL 'http://mindey.com/wamh.jpg'
Content type 'image/jpeg' length 15320 bytes (14 Kb)
opened URL
==================================================
downloaded 14 Kb


In [4]:
%R image(as.matrix(pic[,,1]))