diff options
author | Paweł Jastrzębski <pawelj@iosphe.re> | 2015-10-25 20:04:21 +0100 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@iosphe.re> | 2015-10-25 20:04:21 +0100 |
commit | a93da2136b4d109c0b13e5211fcaa0ecef2b9018 (patch) | |
tree | c6369ce47636f6ca0d597759ece29e5abe7af551 /kcc/image.py | |
parent | Escape special characters in TOC (diff) | |
download | kcc-a93da2136b4d109c0b13e5211fcaa0ecef2b9018.tar.gz kcc-a93da2136b4d109c0b13e5211fcaa0ecef2b9018.tar.bz2 kcc-a93da2136b4d109c0b13e5211fcaa0ecef2b9018.zip |
Added cover upload
Diffstat (limited to 'kcc/image.py')
-rwxr-xr-x | kcc/image.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kcc/image.py b/kcc/image.py index dc6dbee..6dd4d98 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -453,3 +453,11 @@ class Cover: self.image.save(self.target, "JPEG", optimize=1, quality=80) except IOError: raise RuntimeError('Failed to process downloaded cover.') + + def saveToKindle(self, kindle, asin): + self.image = self.image.resize((300, 470), Image.ANTIALIAS).convert('L') + try: + self.image.save(os.path.join(kindle.path.split('documents')[0], 'system', 'thumbnails', + 'thumbnail_' + asin + '_EBOK_portrait.jpg'), 'JPEG') + except IOError: + raise RuntimeError('Failed to upload cover.') |