How to use the svgutils.transform.XLINK function in svgutils

To help you get started, we’ve selected a few svgutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github btel / svg_utils / tests / test_compose.py View on Github external
def test_embedded_image():
    lion_jpg_md5 = 'f4a7c2a05f2acefa50cbd75a32d2733c'

    fig = Figure("5cm", "5cm",
                 Image(120, 120,
                       'examples/files/lion.jpeg')
                 )
    image = fig.root.find(SVG+'image')
    image_data = image.attrib[XLINK+'href']
    image_data = image_data.replace('data:image/jpeg;base64,', '').encode('ascii')
    base64 = codecs.decode(image_data, 'base64')
    md5 = hashlib.md5(base64).hexdigest()

    ok_(lion_jpg_md5 == md5)