diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/parsers/png.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/parsers/png.py b/src/parsers/png.py index 3c0a507..20cd234 100644 --- a/src/parsers/png.py +++ b/src/parsers/png.py | |||
| @@ -7,12 +7,21 @@ from . import abstract | |||
| 7 | 7 | ||
| 8 | class PNGParser(abstract.AbstractParser): | 8 | class PNGParser(abstract.AbstractParser): |
| 9 | mimetypes = {'image/png', } | 9 | mimetypes = {'image/png', } |
| 10 | meta_list = set() | 10 | meta_whitelist = {'SourceFile', 'ExifToolVersion', 'FileName', |
| 11 | 'Directory', 'FileSize', 'FileModifyDate', 'FileAccessDate', | ||
| 12 | "FileInodeChangeDate", 'FilePermissions', 'FileType', | ||
| 13 | 'FileTypeExtension', 'MIMEType', 'ImageWidth', 'BitDepth', 'ColorType', | ||
| 14 | 'Compression', 'Filter', 'Interlace', 'BackgroundColor', 'ImageSize', | ||
| 15 | 'Megapixels', 'ImageHeight'} | ||
| 11 | 16 | ||
| 12 | def get_meta(self): | 17 | def get_meta(self): |
| 13 | out = subprocess.check_output(['exiftool', '-json', self.filename]) | 18 | out = subprocess.check_output(['exiftool', '-json', self.filename]) |
| 14 | return json.loads(out)[0] | 19 | meta = json.loads(out)[0] |
| 20 | for key in self.meta_whitelist: | ||
| 21 | meta.pop(key, None) | ||
| 22 | return meta | ||
| 15 | 23 | ||
| 16 | def remove_all(self): | 24 | def remove_all(self): |
| 17 | surface = cairo.ImageSurface.create_from_png(self.filename) | 25 | surface = cairo.ImageSurface.create_from_png(self.filename) |
| 18 | surface.write_to_png(self.output_filename) | 26 | surface.write_to_png(self.output_filename) |
| 27 | return True | ||
