Merge pull request #7122 from tk0miya/7120_scaling_svg

Fix #7120: html: crashed when on scaling SVG images which have float dimentions
This commit is contained in:
Takeshi KOMIYA 2020-02-11 11:07:20 +09:00 committed by GitHub
commit 0eb3d65e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)