mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Ensure arguments to `PIL.Image.resize()
` are integers (#11288)
Update ``copy_image_files_pil`` so that the computation of ``nh`` is always an integer, as otherwise some calls to ``PIL.Image.resize()`` fail as floats are not allowed Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
3edae68904
commit
063c2e3fbe
@ -424,7 +424,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
(width, height) = img.size
|
||||
nw = self.config.epub_max_image_width
|
||||
if width > nw:
|
||||
nh = (height * nw) / width
|
||||
nh = round((height * nw) / width)
|
||||
img = img.resize((nw, nh), Image.BICUBIC)
|
||||
try:
|
||||
img.save(path.join(self.outdir, self.imagedir, dest))
|
||||
|
Loading…
Reference in New Issue
Block a user