From 544fe9bf1782a027b3f31bf4c10a050d783e32ac Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 1 Feb 2012 22:56:04 +0100 Subject: Rename mat-cli to mat-gui --- lib/images.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lib/images.py (limited to 'lib/images.py') 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 @@ +''' + Takes care about pictures formats +''' + +import parser + + +class JpegStripper(parser.GenericParser): + ''' + represents a jpeg file + remaining : + http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/CanonRaw.html + ''' + def _should_remove(self, field): + ''' + return True if the field is compromizing + ''' + name = field.name + if name.startswith('comment'): + return True + elif name in ('photoshop', 'exif', 'adobe', 'app12'): + return True + elif name in ('icc'): # should we remove the icc profile ? + return True + else: + return False + + +class PngStripper(parser.GenericParser): + ''' + represents a png file + see : http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html + ''' + def _should_remove(self, field): + ''' + return True if the field is compromizing + ''' + name = field.name + if name.startswith('text['): # textual meta + return True + elif name.startswith('utf8_text['): # uncompressed adobe crap + return True + elif name.startswith('compt_text['): # compressed adobe crap + return True + elif name == "time": # timestamp + return True + else: + return False -- cgit v1.3