I’ve been using dash for about 5 months now and have only ever been able to render images via the Base64 method described here: Adding local image
Recently I have been using an EC2 instance to host and have a stock image that I am calling into the app. For whatever reason, I can’t seem to get it to work. I changed permissions to be completely open (777), have the app file and the image file in the same directory, and have the direct file path to the image (essentially /home/img.png).
The code is this:
import dash_html_components as html
app = dash.Dash()
image_filename = os.path.join(os.getcwd(), ‘img.png’)
encoded_image = base64.b64encode(open(image_filename, ‘rb’).read())
app.layout = html.Div([
if name == ‘main’:
To be clear I have created a few apps not using an EC2 instance and the method from Chris’ answer in the forum link above has worked fine.
Was wondering if anyone had run into a similar issue or found a workaround.