diff options
Diffstat (limited to 'src/parsers/png.py')
| -rw-r--r-- | src/parsers/png.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/parsers/png.py b/src/parsers/png.py new file mode 100644 index 0000000..3c0a507 --- /dev/null +++ b/src/parsers/png.py | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | import subprocess | ||
| 2 | import json | ||
| 3 | |||
| 4 | import cairo | ||
| 5 | |||
| 6 | from . import abstract | ||
| 7 | |||
| 8 | class PNGParser(abstract.AbstractParser): | ||
| 9 | mimetypes = {'image/png', } | ||
| 10 | meta_list = set() | ||
| 11 | |||
| 12 | def get_meta(self): | ||
| 13 | out = subprocess.check_output(['exiftool', '-json', self.filename]) | ||
| 14 | return json.loads(out)[0] | ||
| 15 | |||
| 16 | def remove_all(self): | ||
| 17 | surface = cairo.ImageSurface.create_from_png(self.filename) | ||
| 18 | surface.write_to_png(self.output_filename) | ||
