summaryrefslogtreecommitdiff
path: root/lib/images.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/images.py')
-rw-r--r--lib/images.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/images.py b/lib/images.py
new file mode 100644
index 0000000..3eb3544
--- /dev/null
+++ b/lib/images.py
@@ -0,0 +1,48 @@
1'''
2 Takes care about pictures formats
3'''
4
5import parser
6
7
8class JpegStripper(parser.GenericParser):
9 '''
10 represents a jpeg file
11 remaining :
12 http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/CanonRaw.html
13 '''
14 def _should_remove(self, field):
15 '''
16 return True if the field is compromizing
17 '''
18 name = field.name
19 if name.startswith('comment'):
20 return True
21 elif name in ('photoshop', 'exif', 'adobe', 'app12'):
22 return True
23 elif name in ('icc'): # should we remove the icc profile ?
24 return True
25 else:
26 return False
27
28
29class PngStripper(parser.GenericParser):
30 '''
31 represents a png file
32 see : http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html
33 '''
34 def _should_remove(self, field):
35 '''
36 return True if the field is compromizing
37 '''
38 name = field.name
39 if name.startswith('text['): # textual meta
40 return True
41 elif name.startswith('utf8_text['): # uncompressed adobe crap
42 return True
43 elif name.startswith('compt_text['): # compressed adobe crap
44 return True
45 elif name == "time": # timestamp
46 return True
47 else:
48 return False