Handle tiff images with a .tif extension
This commit is contained in:
parent
f5aef1b391
commit
7465cedee7
@ -112,6 +112,8 @@ class GdkPixbufAbstractParser(exiftool.ExiftoolParser):
|
|||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.filename)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.filename)
|
||||||
if extension.lower() == '.jpg':
|
if extension.lower() == '.jpg':
|
||||||
extension = '.jpeg' # gdk is picky
|
extension = '.jpeg' # gdk is picky
|
||||||
|
elif extension.lower() == '.tif':
|
||||||
|
extension = '.tiff' # gdk is picky
|
||||||
try:
|
try:
|
||||||
pixbuf.savev(self.output_filename, type=extension[1:],
|
pixbuf.savev(self.output_filename, type=extension[1:],
|
||||||
option_keys=[], option_values=[])
|
option_keys=[], option_values=[])
|
||||||
|
@ -187,6 +187,15 @@ class TestCorruptedFiles(unittest.TestCase):
|
|||||||
audio.MP3Parser('./tests/data/clean.mp3')
|
audio.MP3Parser('./tests/data/clean.mp3')
|
||||||
os.remove('./tests/data/clean.mp3')
|
os.remove('./tests/data/clean.mp3')
|
||||||
|
|
||||||
|
def test_wrong_tif(self):
|
||||||
|
shutil.copy('./tests/data/dirty.tiff', './tests/data/clean.tif')
|
||||||
|
p = images.TiffParser('./tests/data/clean.tif')
|
||||||
|
p.remove_all()
|
||||||
|
p = images.TiffParser('./tests/data/clean.cleaned.tif')
|
||||||
|
self.assertEqual(p.get_meta(), {})
|
||||||
|
os.remove('./tests/data/clean.tif')
|
||||||
|
os.remove('./tests/data/clean.cleaned.tif')
|
||||||
|
|
||||||
def test_jpg(self):
|
def test_jpg(self):
|
||||||
shutil.copy('./tests/data/dirty.mp3', './tests/data/clean.jpg')
|
shutil.copy('./tests/data/dirty.mp3', './tests/data/clean.jpg')
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
|
Loading…
Reference in New Issue
Block a user