Skip to content

Commit

Permalink
Merge pull request #36 from michamos/fix-rotation
Browse files Browse the repository at this point in the history
Fix rotation
  • Loading branch information
michamos committed Mar 2, 2020
2 parents f0a3c47 + 942f293 commit 8a4b6b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plotextractor/converter.py
Expand Up @@ -205,7 +205,7 @@ def rotate_image(filename, line, sdir, image_list):
:return: True if something was rotated
"""
file_loc = get_image_location(filename, sdir, image_list)
degrees = re.findall('(angle=[-\\d]+|rotate=[-\\d]+)', line)
degrees = re.findall(r'(\bangle=-?[\d]+|\brotate=-?[\d]+)', line)

if len(degrees) < 1:
return False
Expand All @@ -225,6 +225,7 @@ def rotate_image(filename, line, sdir, image_list):
if not os.path.exists(file_loc):
return False

degrees = -degrees # ImageMagick and graphicx use opposite conventions
with Image(filename=file_loc) as image:
with image.clone() as rotated:
rotated.rotate(degrees)
Expand Down

0 comments on commit 8a4b6b1

Please sign in to comment.