From f0fdbab3ec79e0e55f0df55dccd3ef12e466af36 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Jul 2011 14:51:54 -0600 Subject: [PATCH] Allow passing in the path to a custom logo to the create_cover function --- src/calibre/ebooks/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index d5b214884e..c1dee85d3e 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -159,7 +159,7 @@ def normalize(x): return x def calibre_cover(title, author_string, series_string=None, - output_format='jpg', title_size=46, author_size=36): + output_format='jpg', title_size=46, author_size=36, logo_path=None): title = normalize(title) author_string = normalize(author_string) series_string = normalize(series_string) @@ -167,7 +167,9 @@ def calibre_cover(title, author_string, series_string=None, lines = [TextLine(title, title_size), TextLine(author_string, author_size)] if series_string: lines.append(TextLine(series_string, author_size)) - return create_cover_page(lines, I('library.png'), output_format='jpg') + if logo_path is None: + logo_path = I('library.png') + return create_cover_page(lines, logo_path, output_format='jpg') UNIT_RE = re.compile(r'^(-*[0-9]*[.]?[0-9]*)\s*(%|em|ex|en|px|mm|cm|in|pt|pc)$')