(byte_string, color, opacity=255, height=None, width=None)
return "<img %ssrc=\"data:image/png;base64,%s\">" % (
        style,
        base64.b64encode(tint_raw(byte_string, color, opacity)).decode('ascii')
    )
Base64 encode the tint.
Base64 encode the tint.
Base64 encode the tint .
def tint(byte_string, color, opacity=255, height=None, width=None):
    """Base64 encode the tint."""

    style = ''
    if width:
        style = 'style="width: %dpx;"' % width
    if height is not None and style is None:
        style = 'style="height: %dpx;"' % width
    elif height is not None:
        style = style[:-1] + (' height: %dpx;" ' % height)

    return "<img %ssrc=\"data:image/png;base64,%s\">" % (
        style,
        base64.b64encode(tint_raw(byte_string, color, opacity)).decode('ascii')
    )
def tint ( byte_string , color , opacity = 255 , height = None , width = None ) : style = '' if width : style = 'style="width: %dpx;"' % width if height is not None and style is None : style = 'style="height: %dpx;"' % width elif height is not None : style = style [ : - 1 ] + ( ' height: %dpx;" ' % height ) return "<img %ssrc=\"data:image/png;base64,%s\">" % ( style , base64 . b64encode ( tint_raw ( byte_string , color , opacity ) ) . decode ( 'ascii' ) )