4

Two third party Python modules imageio and visvis make it easy to load and view images. The modules come with the pyzo scientific package or can be downloaded separately. Module imageio can read many image file formats as shown in
http://imageio.readthedocs.org/en/latest/formats.html

You could also replace your image file name directly with a URL containing an image, for example
image_file = "Lake2.jpg"
could be changed to
image_file = "http://i.imgur.com/3MnBqHh.jpg"
and your picture would simply come from the internet.

Edited by vegaseat

Votes + Comments
interesting
''' imageio_vv_imageview101.py
imageio can read many image file formats
(also reads file objects, http, zipfiles and bytes)
visvis can display these images

get 
imageio-0.5.1.tar.gz
from
https://pypi.python.org/pypi/imageio

get
visvis-1.8.win-amd64.exe
from
https://pypi.python.org/pypi/visvis/1.8

imageio and visvis come with 
pyzo_distro-2014a.win64.exe
from
http://www.pyzo.org/downloads.html
(includes numpy, pyOpenGl and PySide)

imageio, visvis and pyzo_distro come in Linux and OSX flavors too

see:
http://imageio.readthedocs.org/en/latest/formats.html
https://code.google.com/p/visvis/

tested with Python34-64bit  by vegaseat  09nov2014
'''

import imageio
import visvis as vv

# use an image file you have in the working directory
# or give the full path
image_file = "Lake2.jpg"
img = imageio.imread(image_file)

# optional info
#print(img.shape)  # (300, 400, 3)

vv.title(image_file)

# use visvis to display image
vv.imshow(img)
3
Contributors
2
Replies
26
Views
2 Years
Discussion Span
Last Post by Ene Uran
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.