summaryrefslogtreecommitdiff
path: root/libmat/images.py
diff options
context:
space:
mode:
authorjvoisin2015-02-22 10:10:50 +0100
committerjvoisin2015-02-22 10:15:34 +0100
commit79ce29a7d5e41bb3bb2499bc7eb99164c423aa1d (patch)
tree3c8515874cfb9e0469bf0ea32d18b2fee1a66047 /libmat/images.py
parent655dda11a1eaf740573f019c3e734ef202db2345 (diff)
Preliminary implementation of PIL for images.
PIL (Python Image Library) is used to open, then save images, in order to remove unknown metadata.
Diffstat (limited to '')
-rw-r--r--libmat/images.py16
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
9import parser 9import parser
10import pillow
10 11
11 12
12class JpegStripper(parser.GenericParser): 13class 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
24class 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
37class PngStripper(parser.GenericParser): 49class 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):