Skip to content

Commit 063c2e3

Browse files
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 <[email protected]>
1 parent 3edae68 commit 063c2e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sphinx/builders/_epub_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def copy_image_files_pil(self) -> None:
424424
(width, height) = img.size
425425
nw = self.config.epub_max_image_width
426426
if width > nw:
427-
nh = (height * nw) / width
427+
nh = round((height * nw) / width)
428428
img = img.resize((nw, nh), Image.BICUBIC)
429429
try:
430430
img.save(path.join(self.outdir, self.imagedir, dest))

0 commit comments

Comments
 (0)