diff options
| author | jvoisin | 2014-06-08 13:39:18 +0200 |
|---|---|---|
| committer | jvoisin | 2014-06-08 13:39:18 +0200 |
| commit | af36529554c39a2eefcc2c8723715e2d25b401b8 (patch) | |
| tree | f54b964520bab44d1dfac725086211eaf22d3763 /MAT/images.py | |
| parent | ef5a32cfd3c0555ffe5ddf413eeaae61622ebb4b (diff) | |
Rename the MAT folder to libmat.
This commit fixes some issues for dump operating
systems who doesn't handle capitalization.
Diffstat (limited to 'MAT/images.py')
| -rw-r--r-- | MAT/images.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/MAT/images.py b/MAT/images.py deleted file mode 100644 index 67c710f..0000000 --- a/MAT/images.py +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | ''' Takes care about pictures formats | ||
| 2 | |||
| 3 | References: | ||
| 4 | - JFIF: http://www.ecma-international.org/publications/techreports/E-TR-098.htm | ||
| 5 | - PNG: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html | ||
| 6 | - PNG: http://www.w3.org/TR/PNG-Chunks.html | ||
| 7 | ''' | ||
| 8 | |||
| 9 | import parser | ||
| 10 | |||
| 11 | |||
| 12 | class JpegStripper(parser.GenericParser): | ||
| 13 | ''' Represents a jpeg file. | ||
| 14 | Custom Huffman and Quantization tables | ||
| 15 | are stripped: they may leak | ||
| 16 | some info, and the quality loss is minor. | ||
| 17 | ''' | ||
| 18 | def _should_remove(self, field): | ||
| 19 | ''' Return True if the field is compromising | ||
| 20 | ''' | ||
| 21 | field_list = frozenset([ | ||
| 22 | 'start_image', # start of the image | ||
| 23 | 'app0', # JFIF data | ||
| 24 | 'start_frame', # specify width, height, number of components | ||
| 25 | 'start_scan', # specify which slice of data the top-to-bottom scan contains | ||
| 26 | 'data', # actual data | ||
| 27 | 'end_image']) # end of the image | ||
| 28 | if field.name in field_list: | ||
| 29 | return False | ||
| 30 | elif field.name.startswith('quantization['): # custom Quant. tables | ||
| 31 | return False | ||
| 32 | elif field.name.startswith('huffman['): # custom Huffman tables | ||
| 33 | return False | ||
| 34 | return True | ||
| 35 | |||
| 36 | |||
| 37 | class PngStripper(parser.GenericParser): | ||
| 38 | ''' Represents a png file | ||
| 39 | ''' | ||
| 40 | def _should_remove(self, field): | ||
| 41 | ''' Return True if the field is compromising | ||
| 42 | ''' | ||
| 43 | field_list = frozenset([ | ||
| 44 | 'id', | ||
| 45 | 'header', # PNG header | ||
| 46 | 'physical', # the intended pixel size or aspect ratio | ||
| 47 | 'end']) # end of the image | ||
| 48 | if field.name in field_list: | ||
| 49 | return False | ||
| 50 | if field.name.startswith('data['): # data | ||
| 51 | return False | ||
| 52 | return True | ||
