mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:35:18 +02:00
Bulk trim legacy db
This commit is contained in:
parent
989e6de907
commit
0aa490214b
1 changed files with 9 additions and 0 deletions
|
|
@ -433,6 +433,15 @@ def do_one(self, id):
|
|||
if covers:
|
||||
self.db.set_cover(id, covers[-1][0])
|
||||
covers = []
|
||||
elif cover_action == 'trim':
|
||||
from calibre.utils.magick import Image
|
||||
cdata = self.db.cover(id, index_is_id=True)
|
||||
if cdata:
|
||||
im = Image()
|
||||
im.load(cdata)
|
||||
im.trim(10)
|
||||
cdata = im.export('png')
|
||||
self.db.set_cover(id, cdata)
|
||||
|
||||
if do_remove_format:
|
||||
self.db.remove_format(id, remove_format, index_is_id=True,
|
||||
|
|
|
|||
Loading…
Reference in a new issue