I'm trying to display a base64 encoded image aligned to some HTML text in Jupyter notebooks. The code below is an initial attempt - the image (downloaded from https://stackoverflow.com/company/logos) is show belown the text.
import base64
from io import BytesIO
from IPython.display import Image
from IPython.core.display import display, HTML
with open(r'H:\se-icon.png', 'rb') as f:
data = BytesIO(f.read())
dataEncoded = base64.b64encode(data.getvalue())
display(HTML('<h3>Some Text</h3>'))
display(Image(dataEncoded, format='png', width=100))
The desired output is something like below. Ideally I could use just HTML code, with the img tag, however this does not work for my particular case, as the output of the notebook is emailed on. Use of the img tag does not guarantee that the image is displayed.
Is there any way to display the image aligned to the HTML text?
Some Text
') – anki Feb 27 '19 at 08:14