1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-18 12:03:33 +02:00

Move fit_image to img utils module.

This commit is contained in:
2020-10-13 19:39:05 +02:00
parent 250d0eeea7
commit b44926a6eb
6 changed files with 41 additions and 43 deletions

View File

@@ -1,9 +1,4 @@
from ebook_converter import fit_image
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from ebook_converter.utils import img as uimg
class RescaleImages(object):
@@ -57,7 +52,9 @@ class RescaleImages(object):
except Exception:
self.log.exception('Failed to convert image %s from CMYK to RGB' % item.href)
scaled, new_width, new_height = fit_image(width, height, page_width, page_height)
scaled, new_width, new_height = uimg.fit_image(width, height,
page_width,
page_height)
if scaled:
new_width = max(1, new_width)
new_height = max(1, new_height)