class visigoth.common.image.Image(mime_type='', content_bytes=[], path_or_url='', width=0, height=0, scale=1.0, tooltip='', embed_image=True)

Create an Image (gif,png and jpeg formats are supported)

Keyword Arguments
  • mime_type (str) – the mime type (either image/png, image/jpeg or image/gif)

  • content_bytes (list) – list with the raw bytes of the image

  • path_or_url (str) – the path or URL to the image file

  • width (int) – the width of the image in bytes

  • height (int) – the height of the image in bytes

  • scale (float) – used to scale the image

  • tooltip (str) – a tooltip to display when hovering over the image

  • embed_image (bool) – whether to embed the image content as a data URL or simply link to the image url provided in path_or_url


Caller must provide EITHER path_or_url OR (content_bytes AND mimeType) If width and height are not provided they will be extracted from the image


(Link to open example in new tab):

Source Code (Link to Github):

# -*- coding: utf-8 -*-

import os
import sys

from visigoth import Diagram
from visigoth.common import Image, Text

folder = os.path.split(sys.argv[0])[0]

d = Diagram(fill="white")
            tooltip="MtCleveland Volcano Eruption"))
            tooltip="MtCleveland Volcano Eruption"))
            tooltip="MtCleveland Volcano Eruption"))
d.add(Text("Attribution: Public Domain",url="",font_height=18))
html = d.draw(format="html")

f = open("example.html", "w")