diff --git a/tkhtmlview/html_parser.py b/tkhtmlview/html_parser.py
index 79e2d68..c053e15 100644
--- a/tkhtmlview/html_parser.py
+++ b/tkhtmlview/html_parser.py
@@ -11,6 +11,7 @@
from collections import OrderedDict
import requests
from io import BytesIO
+import base64
# __________________________________________________________________________________________________
@@ -543,6 +544,24 @@ def handle_starttag(self, tag, attrs):
except:
pass
+ if attrs[HTML.Attrs.SRC].startswith(("data:image/jpeg;base64,")):
+ try:
+ image = Image.open(
+ BytesIO(base64.b64decode(attrs[HTML.Attrs.SRC][23:].encode("utf-8")))
+ )
+ self.cached_images[attrs[HTML.Attrs.SRC]] = deepcopy(image)
+ except:
+ pass
+
+ if attrs[HTML.Attrs.SRC].startswith(("data:image/png;base64,", "data:image/gif;base64,")):
+ try:
+ image = Image.open(
+ BytesIO(base64.b64decode(attrs[HTML.Attrs.SRC][22:].encode("utf-8")))
+ )
+ self.cached_images[attrs[HTML.Attrs.SRC]] = deepcopy(image)
+ except:
+ pass
+
if attrs[HTML.Attrs.SRC] in self.cached_images.keys():
image = deepcopy(self.cached_images[attrs[HTML.Attrs.SRC]])
elif os.path.exists(attrs[HTML.Attrs.SRC]):