Commit ab6cba3d authored by Ingo Meyer's avatar Ingo Meyer

Bugfix: Base64 data of embedded images contain the correct image type

parent 1315d901
__version_info__ = (0, 1, 4)
__version_info__ = (0, 1, 5)
__version__ = '.'.join(map(str, __version_info__))
......@@ -26,7 +26,7 @@ def convert_png_to_pillow_image_and_html_base64(png_filepath_or_url):
with open(png_filepath.encode(sys.getfilesystemencoding()), "rb") as image_file:
image_content = image_file.read()
image = Image.open(BytesIO(image_content))
encoded_string = "data:image/png;base64," + base64.b64encode(image_content)
encoded_string = "data:image/{format};base64,".format(format=image.format.lower()) + base64.b64encode(image_content)
return image, encoded_string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment