mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 01:20:32 +00:00
Fix #1531 (white background on transparent cover instead of black one)
This commit is contained in:
parent
25fc6f1937
commit
e27b08203d
@ -35,7 +35,7 @@ except ImportError:
|
||||
lxmlversion = None
|
||||
|
||||
try:
|
||||
from wand.image import Image
|
||||
from wand.image import Image, Color
|
||||
from wand import version as ImageVersion
|
||||
from wand.exceptions import PolicyError
|
||||
use_generic_pdf_cover = False
|
||||
@ -149,6 +149,9 @@ def pdf_preview(tmp_file_path, tmp_dir):
|
||||
img.options["pdf:use-cropbox"] = "true"
|
||||
img.read(filename=tmp_file_path + '[0]', resolution=150)
|
||||
img.compression_quality = 88
|
||||
if img.alpha_channel:
|
||||
img.alpha_channel = 'remove'
|
||||
img.background_color = Color('white')
|
||||
img.save(filename=os.path.join(tmp_dir, cover_file_name))
|
||||
return cover_file_name
|
||||
except PolicyError as ex:
|
||||
|
Loading…
Reference in New Issue
Block a user