Skip to content

Commit

Permalink
Improve wording returned from EXIF image angle (#103)
Browse files Browse the repository at this point in the history
Improve message returned if angle cannot be determined from EXIF.
  • Loading branch information
Alexandre de Siqueira authored Aug 29, 2022
1 parent 9f84c32 commit a0a2262
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mothra/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ def auto_rotate(image_rgb, image_path):
"""
angle = read_angle(image_path)

print(f'Image angle: {angle} deg')
if angle:
print(f'Original EXIF image angle: {angle} deg')
else:
print(f"Couldn't determine EXIF image angle")

if angle not in (None, 0): # angle == 0 does not need untilting
image_rgb = rotate(image_rgb, angle=angle, resize=True)
image_rgb = rotate(image_rgb, angle=angle, resize=True)

return img_as_ubyte(image_rgb)

Expand Down

0 comments on commit a0a2262

Please sign in to comment.