mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Remove IM from DOCX Output
This commit is contained in:
parent
84e4ae6b05
commit
0a3b2a28c6
@ -17,7 +17,7 @@ from lxml import etree
|
|||||||
from calibre.ebooks.oeb.base import urlunquote
|
from calibre.ebooks.oeb.base import urlunquote
|
||||||
from calibre.ebooks.docx.images import pt_to_emu
|
from calibre.ebooks.docx.images import pt_to_emu
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
from calibre.utils.magick.draw import identify_data
|
from calibre.utils.imghdr import identify
|
||||||
|
|
||||||
Image = namedtuple('Image', 'rid fname width height fmt item')
|
Image = namedtuple('Image', 'rid fname width height fmt item')
|
||||||
|
|
||||||
@ -50,11 +50,11 @@ class ImagesManager(object):
|
|||||||
if item is None or not isinstance(item.data, bytes):
|
if item is None or not isinstance(item.data, bytes):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
width, height, fmt = identify_data(item.data)
|
fmt, width, height = identify(item.data)
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log.warning('Replacing corrupted image with blank: %s' % href)
|
self.log.warning('Replacing corrupted image with blank: %s' % href)
|
||||||
item.data = I('blank.png', data=True, allow_user_override=False)
|
item.data = I('blank.png', data=True, allow_user_override=False)
|
||||||
width, height, fmt = identify_data(item.data)
|
fmt, width, height = identify(item.data)
|
||||||
image_fname = 'media/' + self.create_filename(href, fmt)
|
image_fname = 'media/' + self.create_filename(href, fmt)
|
||||||
image_rid = self.document_relationships.add_image(image_fname)
|
image_rid = self.document_relationships.add_image(image_fname)
|
||||||
self.images[href] = Image(image_rid, image_fname, width, height, fmt, item)
|
self.images[href] = Image(image_rid, image_fname, width, height, fmt, item)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user