Hi @Luidgi
You almost had it with your first bullet. Rather than converting the base64 bytes object to a string using the str
constructor, you need to decode it into a string using the .decode()
method.
img = py.image.get(fig)
img_uri = "data:image/png;base64," + base64.b64encode(img).decode('utf8')
If youโre in the Jupyter Notebook you can check to make sure it worked by displaying img_uri
as follows
from IPython.display import Image
Image(url=img_uri)
Hope that helps!