summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Reinders <github@collect3.com>2023-04-06 15:51:18 -0700
committerGitHub <noreply@github.com>2023-04-06 23:51:18 +0100
commit063c2e3fbeefef2def5dc7259aeb26e3db3987fa (patch)
treed782de9e9f61d7b420e993b4a5747625d2ca95c3
parent3edae689040301e0b0833bb0321f265784874ff5 (diff)
downloadsphinx-git-063c2e3fbeefef2def5dc7259aeb26e3db3987fa.tar.gz
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>
-rw-r--r--sphinx/builders/_epub_base.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py
index a64e2fc6c..dfe4877ec 100644
--- a/sphinx/builders/_epub_base.py
+++ b/sphinx/builders/_epub_base.py
@@ -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))