X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/9c1ccb775783170750653a1add478802cbc2844f..25af49b6c63e1c005129856e107143864ad5b245:/librarian/formats/cover/__init__.py diff --git a/librarian/formats/cover/__init__.py b/librarian/formats/cover/__init__.py index 7a787e8..b9b515a 100644 --- a/librarian/formats/cover/__init__.py +++ b/librarian/formats/cover/__init__.py @@ -126,6 +126,7 @@ class Cover(Format): logo_bottom = None logo_width = None + logo_file = get_resource('res/wl-logo.png') uses_dc_cover = False format = 'JPEG' @@ -164,14 +165,17 @@ class Cover(Format): if self.background_img: background = Image.open(self.background_img) - img.paste(background, None, background) - del background + resized = background.resize((1024, background.height*1024/background.width), Image.ANTIALIAS) + resized = resized.convert('RGBA') + img.paste(resized, (0, 0), resized) + del background, resized - # WL logo if metr.logo_width: - logo = Image.open(get_resource('res/wl-logo.png')) - logo = logo.resize((metr.logo_width, logo.size[1] * metr.logo_width / logo.size[0])) - img.paste(logo, ((metr.width - metr.logo_width) / 2, img.size[1] - logo.size[1] - metr.logo_bottom)) + logo = Image.open(self.logo_file) + logo = logo.resize((metr.logo_width, logo.size[1] * metr.logo_width / logo.size[0]), Image.ANTIALIAS) + logo = logo.convert('RGBA') + img.paste(logo, ((metr.width - metr.logo_width) / 2, + img.size[1] - logo.size[1] - metr.logo_bottom), logo) top = metr.author_top tbox = TextBox(