图像不显示在ipython中 [英] image does not display in ipython

查看:676
本文介绍了图像不显示在ipython中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果图像是while循环的一部分,则不会加载图像。对于例如以下按预期工作:

The image does not load if it is part of a while loop. For e.g. the following works as expected:

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

但这不起作用:

while True:
    Image(filename='someimage.jpg')
    break

更新:

如何从列表中显示多个图像?

How do I display several images from a list?

推荐答案

这里的工作正常:

from IPython.display import display, Image

path1 = "/some/path/to/image1.png"
path2 = "/some/path/to/image2.png"

for path in path1, path2:
    img = Image(path)
    display(img)

这篇关于图像不显示在ipython中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆