mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Output: Fix preserve cover aspect ratio option still distorting the aspect ratio slightly. Fixes #1721864 [Preserve Aspect Ration Stretches Image](https://bugs.launchpad.net/calibre/+bug/1721864)
This commit is contained in:
parent
e972119109
commit
4307856fa9
@ -189,9 +189,11 @@ class ImagesManager(object):
|
||||
makeelement, namespaces = self.document_relationships.namespace.makeelement, self.document_relationships.namespace.namespaces
|
||||
if preserve_aspect_ratio:
|
||||
if img.width >= img.height:
|
||||
height *= img.height / img.width
|
||||
ar = img.height / img.width
|
||||
height = ar * width
|
||||
else:
|
||||
width *= img.width / img.height
|
||||
ar = img.width / img.height
|
||||
width = ar * height
|
||||
|
||||
root = etree.Element('root', nsmap=namespaces)
|
||||
ans = makeelement(root, 'w:drawing', append=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user