summaryrefslogtreecommitdiff
path: root/src/jpg.py
diff options
context:
space:
mode:
authorjvoisin2018-04-01 00:43:36 +0200
committerjvoisin2018-04-01 00:43:36 +0200
commit2d7c703c52cae50034fc9618c72552365f7cc741 (patch)
treec6fcd139ea0ea5d6970f8a5bb53b1bf719f222e4 /src/jpg.py
parentc186fc42929b2660e5c507adeb8a8fb406593b11 (diff)
Add support for .tiff files
Diffstat (limited to 'src/jpg.py')
-rw-r--r--src/jpg.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/jpg.py b/src/jpg.py
deleted file mode 100644
index 34fc04c..0000000
--- a/src/jpg.py
+++ /dev/null
@@ -1,30 +0,0 @@
1import subprocess
2import json
3
4import gi
5gi.require_version('GdkPixbuf', '2.0')
6from gi.repository import GdkPixbuf
7
8from . import abstract
9
10class JPGParser(abstract.AbstractParser):
11 mimetypes = {'image/jpg', }
12 meta_whitelist = {'SourceFile', 'ExifToolVersion', 'FileName',
13 'Directory', 'FileSize', 'FileModifyDate', 'FileAccessDate',
14 "FileInodeChangeDate", 'FilePermissions', 'FileType',
15 'FileTypeExtension', 'MIMEType', 'ImageWidth',
16 'ImageSize', 'BitsPerSample', 'ColorComponents', 'EncodingProcess',
17 'JFIFVersion', 'ResolutionUnit', 'XResolution', 'YCbCrSubSampling',
18 'YResolution', 'Megapixels', 'ImageHeight'}
19
20 def get_meta(self):
21 out = subprocess.check_output(['exiftool', '-json', self.filename])
22 meta = json.loads(out.decode('utf-8'))[0]
23 for key in self.meta_whitelist:
24 meta.pop(key, None)
25 return meta
26
27 def remove_all(self):
28 pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.filename)
29 pixbuf.savev(self.output_filename, "jpeg", ["quality"], ["100"])
30 return True