diff options
| author | jvoisin | 2012-12-08 02:02:25 +0100 |
|---|---|---|
| committer | jvoisin | 2012-12-13 14:24:01 +0100 |
| commit | cbf8a2a65928694202e19b6bcf56ec84bcbf613c (patch) | |
| tree | e106475b0d5c003505336b5ae6416e4508bb768b /MAT/images.py | |
| parent | 67d5c1fa6b9ab6e1e7328ee57b15d8e46526d72a (diff) | |
Reorganize source tree and files installation location, cleanup setup.py (Closes: #689409)
Diffstat (limited to 'MAT/images.py')
| -rw-r--r-- | MAT/images.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/MAT/images.py b/MAT/images.py new file mode 100644 index 0000000..236d566 --- /dev/null +++ b/MAT/images.py | |||
| @@ -0,0 +1,41 @@ | |||
| 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 | ''' | ||
| 12 | def _should_remove(self, field): | ||
| 13 | ''' | ||
| 14 | return True if the field is compromizing | ||
| 15 | ''' | ||
| 16 | field_list = frozenset(['start_image', 'app0', 'start_frame', | ||
| 17 | 'start_scan', 'data', 'end_image']) | ||
| 18 | if field.name in field_list: | ||
| 19 | return False | ||
| 20 | elif field.name.startswith('quantization['): | ||
| 21 | return False | ||
| 22 | elif field.name.startswith('huffman['): | ||
| 23 | return False | ||
| 24 | return True | ||
| 25 | |||
| 26 | |||
| 27 | class PngStripper(parser.GenericParser): | ||
| 28 | ''' | ||
| 29 | represents a png file | ||
| 30 | see : http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html | ||
| 31 | ''' | ||
| 32 | def _should_remove(self, field): | ||
| 33 | ''' | ||
| 34 | return True if the field is compromizing | ||
| 35 | ''' | ||
| 36 | field_list = frozenset(['id', 'header', 'physical', 'end']) | ||
| 37 | if field.name in field_list: | ||
| 38 | return False | ||
| 39 | if field.name.startswith('data['): | ||
| 40 | return False | ||
| 41 | return True | ||
