diff options
Diffstat (limited to 'libmat/images.py')
| -rw-r--r-- | libmat/images.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libmat/images.py b/libmat/images.py index 67c710f..2daea88 100644 --- a/libmat/images.py +++ b/libmat/images.py | |||
| @@ -7,9 +7,21 @@ References: | |||
| 7 | ''' | 7 | ''' |
| 8 | 8 | ||
| 9 | import parser | 9 | import parser |
| 10 | import pillow | ||
| 10 | 11 | ||
| 11 | 12 | ||
| 12 | class JpegStripper(parser.GenericParser): | 13 | class ImageStripper(parser.GenericParser, pillow.PillowStripper): |
| 14 | ''' Common stripper for images. | ||
| 15 | Its purpose is to open then save | ||
| 16 | images with PIL, the goal being to remove | ||
| 17 | unknown metadata. | ||
| 18 | ''' | ||
| 19 | def remove_all(self): | ||
| 20 | self.open_and_save() | ||
| 21 | super(ImageStripper, self).remove_all() | ||
| 22 | |||
| 23 | |||
| 24 | class JpegStripper(ImageStripper): | ||
| 13 | ''' Represents a jpeg file. | 25 | ''' Represents a jpeg file. |
| 14 | Custom Huffman and Quantization tables | 26 | Custom Huffman and Quantization tables |
| 15 | are stripped: they may leak | 27 | are stripped: they may leak |
| @@ -34,7 +46,7 @@ class JpegStripper(parser.GenericParser): | |||
| 34 | return True | 46 | return True |
| 35 | 47 | ||
| 36 | 48 | ||
| 37 | class PngStripper(parser.GenericParser): | 49 | class PngStripper(ImageStripper): |
| 38 | ''' Represents a png file | 50 | ''' Represents a png file |
| 39 | ''' | 51 | ''' |
| 40 | def _should_remove(self, field): | 52 | def _should_remove(self, field): |
