summaryrefslogtreecommitdiff
path: root/src/png.py
diff options
context:
space:
mode:
authorjvoisin2018-04-01 12:30:00 +0200
committerjvoisin2018-04-01 12:30:00 +0200
commit27beda354d8b78c1716e659273c180d4ddfb144b (patch)
tree5420d509f2538f742405771d8433e81ce2984148 /src/png.py
parent711347c87f189a4fd1bd425144934016b79f099c (diff)
Move every image-related parser into a single file
Diffstat (limited to 'src/png.py')
-rw-r--r--src/png.py27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/png.py b/src/png.py
deleted file mode 100644
index 377682e..0000000
--- a/src/png.py
+++ /dev/null
@@ -1,27 +0,0 @@
1import subprocess
2import json
3
4import cairo
5
6from . import abstract
7
8class PNGParser(abstract.AbstractParser):
9 mimetypes = {'image/png', }
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'}
16
17 def get_meta(self):
18 out = subprocess.check_output(['exiftool', '-json', self.filename])
19 meta = json.loads(out.decode('utf-8'))[0]
20 for key in self.meta_whitelist:
21 meta.pop(key, None)
22 return meta
23
24 def remove_all(self):
25 surface = cairo.ImageSurface.create_from_png(self.filename)
26 surface.write_to_png(self.output_filename)
27 return True