diff options
| author | jvoisin | 2012-02-01 22:56:04 +0100 |
|---|---|---|
| committer | jvoisin | 2012-02-01 22:56:04 +0100 |
| commit | 544fe9bf1782a027b3f31bf4c10a050d783e32ac (patch) | |
| tree | a8dd60b9ae45efea4875fdb827070531f0199717 /lib/images.py | |
| parent | 9ea6dc6960cebfa70d18ba8ee49d775ea91c9b34 (diff) | |
Rename mat-cli to mat-gui
Diffstat (limited to 'lib/images.py')
| -rw-r--r-- | lib/images.py | 48 |
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 | |||
| 5 | import parser | ||
| 6 | |||
| 7 | |||
| 8 | class 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 | |||
| 29 | class 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 | ||
