image_to_html_element¶
- image_to_html_element(location, name=None, width=None, height=None, unit='px', data_format=None)¶
Convert an image file or URL to a self-contained HTML element with base64 encoded data.
- Parameters
data (str) – Filepath or URL of an image.
name (str, optional) – Name shown if the image can not be shown in the browser.
width (int, optional) – Width of the HTML element in pixels.
height (int, optional) – Height of the HTML element in pixels.
unit (str, optional) – Unit for width and height parameters.
Available options: See CSS values and units
data_format (str, optional) – By default, the format of the image data is guessed from the file or URL ending of the
location
argument, or if that fails, from features of the binary data. Alternatively, the format can be passed explicitly with this argument, so no potentially incorrect guessing has to be done.
- Returns
html_element (str) – A suitable HTML element for the image format that contains the data in form of a data URL.
References