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

This commit is contained in:
Takeshi KOMIYA 2020-02-09 22:22:27 +09:00
parent c86e17d4be
commit 6cdc09272e
2 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,8 @@ Features added
Bugs fixed
----------
* #7120: html: crashed when on scaling SVG images which have float dimentions
Testing
--------

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)