Render a captcha image to dash app

I don’t recall exactly where I saw this in the forums a long time ago, but its worked for me since. Here is what I do:

path = 'path_to_logo'  # usually this is in the assets folder
img_tunel = base64.b64encode(open(path, 'rb').read())
image = html.Img(src='data:image/png;base64,{}'.format(img_tunel.decode()))
3 Likes