简体   繁体   English

在iPython qtconsole中显示图像

[英]Displaying an Image in the iPython qtconsole

I'm trying to display an image in the ipython qtconsole via: 我试图通过以下方式在ipython qtconsole中显示图像:

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. 我通过Anaconda安装了python,它具有显示图像所需的库。 I tried searching stackoverflow and couldn't find any answers yet. 我尝试搜索stackoverflow,但还没有找到任何答案。

The version of python i'm running is: 我正在运行的python版本是:

  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. 我想让这个工作的原因是我正在搞乱google deepdream项目,看起来非常有趣和疯狂。 See: https://github.com/google/deepdream/blob/master/dream.ipynb 请参阅: 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! 对不起,如果这是一个简单的问题,从来没有使用python,我一直在敲打我几个小时!

Thanks! 谢谢!

The following code should work although I must admit I don't use IPython that much. 下面的代码应该可以工作,虽然我必须承认我没有那么多使用IPython。

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: 我在使用display后发现一次Image渲染:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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