1
0
Fork 0
mirror of synced 2025-07-04 20:37:34 +02:00

Test for faulty files, and document how MAT2 is behaving wrt. them

This commit is contained in:
jvoisin 2018-05-06 21:58:31 +02:00
parent 459e9b82f7
commit b02d72887a
5 changed files with 38 additions and 3 deletions

View file

@ -20,6 +20,13 @@ class PNGParser(abstract.AbstractParser):
'Compression', 'Filter', 'Interlace', 'BackgroundColor', 'ImageSize',
'Megapixels', 'ImageHeight'}
def __init__(self, filename):
super().__init__(filename)
try: # better fail here than later
cairo.ImageSurface.create_from_png(self.filename)
except MemoryError:
raise ValueError
def get_meta(self):
out = subprocess.check_output(['/usr/bin/exiftool', '-json', self.filename])
meta = json.loads(out.decode('utf-8'))[0]