mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix img flip regression in PDF
PDF Input: Fix a regression that caused some images to be flipped when converting PDF files that use image rotation operators. See #1201083
This commit is contained in:
parent
34abccc4f1
commit
9ec8aac3f4
@ -118,7 +118,7 @@ def flip_image(img, flip):
|
||||
im.save(img)
|
||||
|
||||
def flip_images(raw):
|
||||
for match in re.finditer(b'<IMG[^>]+/?>', raw):
|
||||
for match in re.finditer(b'<IMG[^>]+/?>', raw, flags=re.I):
|
||||
img = match.group()
|
||||
m = re.search(br'class="(x|y|xy)flip"', img)
|
||||
if m is None: continue
|
||||
@ -127,7 +127,6 @@ def flip_images(raw):
|
||||
if src is None: continue
|
||||
img = src.group(1)
|
||||
if not os.path.exists(img): continue
|
||||
print ('Flipping image %s: %s'%(img, flip))
|
||||
flip_image(img, flip)
|
||||
raw = re.sub(br'<STYLE.+?</STYLE>\s*', b'', raw, flags=re.I|re.DOTALL)
|
||||
return raw
|
||||
|
Loading…
x
Reference in New Issue
Block a user