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:
James Reinders 2023-04-06 15:51:18 -07:00 committed by GitHub
parent 3edae68904
commit 063c2e3fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))