Adding local image

Another solution would be to base64 encode the image and set it as a string in the html.Img component directly (instead of serving the image).

Here’s a quick example:

import dash
import dash_html_components as html
import base64

app = dash.Dash()

image_filename = 'my-image.png' # replace with your own image
encoded_image = base64.b64encode(open(image_filename, 'rb').read())

app.layout = html.Div([

if __name__ == '__main__':
1 Like