mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
commit
0eb3d65e47
2
CHANGES
2
CHANGES
@ -16,6 +16,8 @@ Features added
|
|||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* #7120: html: crashed when on scaling SVG images which have float dimentions
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ def get_image_size(filename: str) -> Tuple[int, int]:
|
|||||||
size = imagesize.get(filename)
|
size = imagesize.get(filename)
|
||||||
if size[0] == -1:
|
if size[0] == -1:
|
||||||
size = None
|
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
|
if size is None and Image: # fallback to Pillow
|
||||||
im = Image.open(filename)
|
im = Image.open(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user