简体   繁体   中英

Displaying an Image in the iPython qtconsole

I'm trying to display an image in the ipython qtconsole via:

from IPython.display import Image
Image(filename='sky1024px.jpg')

But I get the following output

Out[6]: <IPython.core.display.Image object>

I installed python via Anaconda which has the needed library to display images. I tried searching stackoverflow and couldn't find any answers yet.

The version of python i'm running is:

  IPython QtConsole 3.2.0
  Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, May 28 2015, 17:04:42) 

The reason I want to get this working is I'm messing around with the google deepdream project which looks pretty fun and crazy. See: https://github.com/google/deepdream/blob/master/dream.ipynb

Sorry if this is simple question never used python and i'm been banging my head on this for a few hours!

Thanks!

The following code should work although I must admit I don't use IPython that much.

from PIL import Image
im = Image.open('/home/students/sky1024px.jpg')
im.show()

I found after I'd used display once Image s were rendered:

from IPython.core.display import Image, display
display(Image('https://upload.wikimedia.org/wikipedia/commons/2/2a/Svm_max_sep_hyperplane_with_margin.png'))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM