X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/db772f02e1800391c1699002e16729ab8872675e..28d85f12957a4b8609b4f419e70dd42a22b57765:/librarian/cover.py?ds=inline diff --git a/librarian/cover.py b/librarian/cover.py index 2f3117c..0266b4e 100644 --- a/librarian/cover.py +++ b/librarian/cover.py @@ -142,6 +142,8 @@ class Cover(object): self.title = book_info.title if format is not None: self.format = format + if width and height: + self.height = height * self.width / width scale = max(float(width or 0) / self.width, float(height or 0) / self.height) if scale >= 1: self.scale = scale @@ -214,7 +216,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()