cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How can I embed image to my notebook?

Anonymous
Not applicable
 
1 ACCEPTED SOLUTION

Accepted Solutions

sean_owen
Honored Contributor II
Honored Contributor II

If the image is a result of, for example, a plotting library's output, it should just render as-is.

If it's not, then one simple approach is to write a markdown (%md) cell and include a link to the image:

![](url of the image)

Of course this requires that the image be available somewhere to link to. You can write images to /FileStore on DBFS, and they become available at a URL in your workspace starting with /files. Note that this isn't exactly secure though, as anyone in the workspace could potentially see that file. In some cases that's fine.

For small images, you could encode the bytes of the PNG (for example) image in base64 and then construct a a "data:" URI with that image data. That becomes a self-contained URI you can render in HTML in a markdown cell like any other image. That's only a good idea for pretty small images though.

View solution in original post

1 REPLY 1

sean_owen
Honored Contributor II
Honored Contributor II

If the image is a result of, for example, a plotting library's output, it should just render as-is.

If it's not, then one simple approach is to write a markdown (%md) cell and include a link to the image:

![](url of the image)

Of course this requires that the image be available somewhere to link to. You can write images to /FileStore on DBFS, and they become available at a URL in your workspace starting with /files. Note that this isn't exactly secure though, as anyone in the workspace could potentially see that file. In some cases that's fine.

For small images, you could encode the bytes of the PNG (for example) image in base64 and then construct a a "data:" URI with that image data. That becomes a self-contained URI you can render in HTML in a markdown cell like any other image. That's only a good idea for pretty small images though.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.