Describe the bug
After updating to Sphinx 2.4.0 my HTML builds start failing due to imagesize.get() returning float values.
Exception occurred:
File "/home/user/.cache/pypoetry/virtualenvs/project-TWo7gGTJ-py3.8/lib/python3.8/site-packages/sphinx/writers/html5.py", line 548, in visit_image
atts['width'] = int(atts['width']) * scale
ValueError: invalid literal for int() with base 10: '5760.0'
To Reproduce
Steps to reproduce the behavior:
Include an SVG figure
.. figure:: ./img/some_svg.*
:scale: 100
The error is raised at html5.py:#L548 and due to the returned float values at images.py#L45.
Expected behavior
Image dimensions are converted to int, e.g. like:
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]))
Environment info
Sorry for inconvenience. I'll fix this soon.
Fixed in #7122
It will be released within a day. Please wait a moment.