From: Radek Czajka Date: Tue, 25 Feb 2014 13:19:52 +0000 (+0100) Subject: PDF cover: higher resolution, lower quality. X-Git-Tag: 1.7~105 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/ebe02c4c8c6e0bb91fe6a31b1648fab17f23d097?ds=inline PDF cover: higher resolution, lower quality. --- diff --git a/librarian/cover.py b/librarian/cover.py index 2f3117c..21eedc3 100644 --- a/librarian/cover.py +++ b/librarian/cover.py @@ -214,7 +214,12 @@ class Cover(object): return self.exts[self.format] def save(self, *args, **kwargs): - return self.final_image().save(format=self.format, quality=95, *args, **kwargs) + default_kwargs = { + 'format': self.format, + 'quality': 95, + } + default_kwargs.update(kwargs) + return self.final_image().save(*args, **default_kwargs) def output_file(self, *args, **kwargs): imgstr = StringIO() diff --git a/librarian/pdf.py b/librarian/pdf.py index af258fc..7aaff10 100644 --- a/librarian/pdf.py +++ b/librarian/pdf.py @@ -206,7 +206,7 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, if cover: if cover is True: cover = DefaultEbookCover - bound_cover = cover(book_info) + bound_cover = cover(book_info, width=1200) root.set('data-cover-width', str(bound_cover.width)) root.set('data-cover-height', str(bound_cover.height)) if bound_cover.uses_dc_cover: @@ -267,7 +267,7 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, if cover: with open(os.path.join(temp, 'cover.png'), 'w') as f: - bound_cover.save(f) + bound_cover.save(f, quality=80) del document # no longer needed large object :)