diff options
Diffstat (limited to 'util.py')
-rw-r--r-- | util.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -8,6 +8,7 @@ import collections import urllib.parse import multiprocessing import pathlib +import base64 from configparser import ConfigParser import requests @@ -79,6 +80,10 @@ def sanitize_text(text): sanitized += replacement_map[char] return sanitized +def generate_base64_icon(filename): + with open(filename, "rb") as f: + return "data:image/png;base64," + base64.b64encode(f.read()).decode("utf8") + def read_file(fil): """ |