mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
Fail gracefully when exif orientation usupported
This commit is contained in:
parent
f9590e9f2e
commit
b2c8b867f2
3 changed files with 15 additions and 3 deletions
|
|
@ -24,6 +24,7 @@ Fixed
|
|||
correctly depending on the selected images.
|
||||
* Removed black line under marching ants outline of crop mode, which
|
||||
would scale with the image and get potentially very thick.
|
||||
* Fixed a crash when importing images with unsupported exif orientation info
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,13 @@ def exif_rotated_image(path=None):
|
|||
logger.exception(f'Exif parser failed on image: {path}')
|
||||
return img
|
||||
|
||||
if 'orientation' in exifimg.list_all():
|
||||
orientation = exifimg.orientation
|
||||
else:
|
||||
try:
|
||||
if 'orientation' in exifimg.list_all():
|
||||
orientation = exifimg.orientation
|
||||
else:
|
||||
return img
|
||||
except NotImplementedError:
|
||||
logger.exception(f'Exif failed reading orientation of image: {path}')
|
||||
return img
|
||||
|
||||
transform = QtGui.QTransform()
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ def test_exif_rotated_image_exif_unpack_error(qapp, imgfilename3x3):
|
|||
assert img.isNull() is False
|
||||
|
||||
|
||||
def test_exif_rotated_image_exif_notimplementederror(qapp, imgfilename3x3):
|
||||
with patch('beeref.fileio.image.exif.Image.list_all',
|
||||
side_effect=NotImplementedError()):
|
||||
img = exif_rotated_image(imgfilename3x3)
|
||||
assert img.isNull() is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize('path,expected',
|
||||
[('test3x3.png', 'test3x3.png'),
|
||||
('test3x3_orientation1.jpg', 'test3x3.jpg'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue