Fix #7120: html: crashed when on scaling SVG images which have float dimentions

This commit is contained in:
Takeshi KOMIYA committed 2020-02-09 22:22:27 +09:00
1 parent c86e17d4be
commit 6cdc09272e
2 files changed
+4

No files matched your search

+2
View File
@@ -16,6 +16,8 @@ Features added
Bugs fixed
----------
* #7120: html: crashed when on scaling SVG images which have float dimentions
Testing
--------
+2
View File
@@ -45,6 +45,8 @@ def get_image_size(filename: str) -> Tuple[int, int]:
size = imagesize.get(filename)
if size[0] == -1:
size = None
elif isinstance(size[0], float) or isinstance(size[1], float):
size = (int(size[0]), int(size[1]))
if size is None and Image: # fallback to Pillow
im = Image.open(filename)