mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2054125 [ValueError: Failed to export image as JPEG with error: Image is empty](https://bugs.launchpad.net/calibre/+bug/2054125)
This commit is contained in:
parent
be8082790a
commit
34743e4807
@ -272,7 +272,12 @@ def save_cover_data_to(
|
|||||||
changed = True
|
changed = True
|
||||||
img = img.scaled(int(resize_to[0]), int(resize_to[1]), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation)
|
img = img.scaled(int(resize_to[0]), int(resize_to[1]), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation)
|
||||||
owidth, oheight = img.width(), img.height()
|
owidth, oheight = img.width(), img.height()
|
||||||
nwidth, nheight = tweaks['maximum_cover_size'] if minify_to is None else minify_to
|
if minify_to is None:
|
||||||
|
nwidth, nheight = tweaks['maximum_cover_size']
|
||||||
|
nwidth, nheight = max(1, nwidth), max(1, nheight)
|
||||||
|
else:
|
||||||
|
nwidth, nheight = minify_to
|
||||||
|
|
||||||
if letterbox:
|
if letterbox:
|
||||||
img = blend_on_canvas(img, nwidth, nheight, bgcolor=letterbox_color)
|
img = blend_on_canvas(img, nwidth, nheight, bgcolor=letterbox_color)
|
||||||
# Check if we were minified
|
# Check if we were minified
|
||||||
|
Loading…
x
Reference in New Issue
Block a user