Display multiple images in one IPython Notebook cell?

后端 未结 10 1502
面向向阳花
面向向阳花 2020-12-12 12:26

If I have multiple images (loaded as NumPy arrays) how can I display the in one IPython Notebook cell?

I know that I can use plt.imshow(ima) to display

10条回答
  •  没有蜡笔的小新
    2020-12-12 13:10

    You can display multiple images in one IPython Notebook cell by using display and HTML functions. You need to create the set of html img tags as a string as follows

    from IPython.display import Image, HTML, display
    from glob import glob
    imagesList=''.join( ["" % str(s) 
                     for s in sorted(glob('yourimage*.png')) ])
    display(HTML(imagesList))
    

    See a example of use from http://nbviewer.ipython.org/github/PBrockmann/Dodecahedron

    You may need to refresh your browser (shift + load) to see new images if they have been changed from a previous cell.

提交回复
热议问题