cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
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
Databricks Employee
Databricks Employee

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
Databricks Employee
Databricks Employee

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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group