From 063c2e3fbeefef2def5dc7259aeb26e3db3987fa Mon Sep 17 00:00:00 2001 From: James Reinders Date: Thu, 6 Apr 2023 15:51:18 -0700 Subject: [PATCH] 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> --- sphinx/builders/_epub_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))