How can I open images in a Google Colaboratory notebook cell from uploaded png files?

Try this

from IPython.display import Image
Image("https://stackoverflow.com/questions/49478791/bp.png")

You can set width and height as well

Image("bp.png", width=100, height=100)

To display more than 1 image, you need to call display. (it’s auto for just 1 image)

from IPython.display import Image, display
display(Image('1.png'))
display(Image('2.png'))

Update jan/2019

Put your image in /usr/local/share/jupyter/nbextensions/

Then display it from /nbextensions/, e.g.

%%html
<img src="https://stackoverflow.com/nbextensions/image.png" />

Update feb/2022

In Google Colab, open the file browser icon (left nav bar) and navigate to usr/local/share/jupyter/nbextensions as described above. Click the ellipsis menu on the nbextensions folder > Upload and select your image to upload. Make sure to update the img tag from the code snippet above with the correct file name, and you’ll want to use a code box (not text). Note that your image will be deleted from the directory when your runtime is recycled (I got a warning dialog stating so when I uploaded my image), so be careful with that.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)