Test for faulty files, and document how MAT2 is behaving wrt. them
This commit is contained in:
parent
459e9b82f7
commit
b02d72887a
5 changed files with 38 additions and 3 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue