diff options
| author | jvoisin | 2018-03-20 01:20:11 +0100 |
|---|---|---|
| committer | jvoisin | 2018-03-20 01:20:11 +0100 |
| commit | d48dfc8e218c3e762a385f14d0c788115c2a72fa (patch) | |
| tree | aff82bc511fd7b7cf2d1f9ecf71665454558ab37 /src/parsers/png.py | |
| parent | 47c5d8b4862a70ca0f4acd0f9bfd408545277a82 (diff) | |
PNG support and automatic import!
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) | ||
