How to insert an inline image in Google Colaboratory from Google Drive

大憨熊 提交于 2019-12-05 05:26:55

According to the answers here

![](https://drive.google.com/uc?export=view&id=XXX)
Shaswat Lenka

I tried all the answers above and nothing worked because of a small change Google has created recently(at the time of writing this post). If you click on "Get Shareable link" and paste it, it would look something like this:

https://drive.google.com/open?id=12BumFEqzKxc9mog8tYuUqvpxf10ot6W3

Now just change the open?id to uc?id and it will instantly work.

guvenim

Unfortunately, I have tried the methods above but they didn't work for me. Then I have tried simply right-clicking on the picture that I want to display on colab, and choose 'Get a sharable link', then the link is automatically copied to my clipboard:

The link will be something like

https://docs.google.com/uc?id=-----

Then using colab's picture inserting button, and insert that link to the (https://) part

![picture](your link)

worked like a magic!

However, if you get a link like this

https://drive.google.com/file/d/-------/view?usp=sharing

after making picture public, it somehow doesn't work.

Here is an example using plain html instead of markdown.

<figure>
<center>
<img src='https://drive.google.com/uc?id=1Rb6oXW3KufLApvID5MwxsknpoON2CkQ_' />
<figcaption>Image Caption</figcaption></center>
</figure>

This way, you can also center the image, add captions etc

From the next 3 formats only the first one worked for me:

![](https://drive.google.com/uc?export=view&id=0B3SU50kcW4Q4WFlla00tX3hkdkE)    
![](https://drive.google.com/file/d/0B3SU50kcW4Q4WFlla00tX3hkdkE)    
![](https://drive.google.com/open?id=0B3SU50kcW4Q4WFlla00tX3hkdkE)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!