How do I embed a gif in Jupyter notebook?

前端 未结 3 2131
谎友^
谎友^ 2021-02-07 22:02

I\'ve been trying to display a gif in Jupyter notebook and have had some trouble. I keep getting a blank image file.

I\'ve tried using html from this GitHub repository.

3条回答
  •  感情败类
    2021-02-07 22:34

    Any image format either png, jpg, jpeg or gif etc, you want to show in python jupyter notebook then simply use matplotlib library.

    import matplotlib.pyplot as plt
    
    import matplotlib.image as mpimg
    
    img = mpimg.imread("/home/gaurav/assignment/sofcomputing/river.gif")
    
    plt.imshow(img)
    

提交回复
热议问题