Function iareadurl

Synopse

The iareadurl reads an image from an URL path.

  • f = iareadurl(url)
    • Output
      • f: ndarray, image, RGB color or gray scale.
    • Input
      • url: string, URL path.

Description

The iareadurl function reads the image which is available at the internet at the URL path.

Function Code

1. def iareadurl(url):
2.     from StringIO import StringIO
3.     import urllib
4.     import PIL
5.     import adpil
6. 
7.     file = StringIO(urllib.urlopen(url).read())
8.     img = PIL.Image.open(file)
9.     return adpil.pil2array(img)

Examples

1. import ia636 as ia
2. urlpath = 'http://www.fee.unicamp.br/sites/default/files/Slider_CPG_1.jpg'
3. f = ia.iareadurl(urlpath)
4. adshow(f)

See Also

Contributions

  • Roberto Lotufo, 28oct2013: initial function.