@@ -14,12 +14,14 @@ def test_sanity(self):
14
14
self .assertEqual (im .mode , "RGB" )
15
15
self .assertEqual (im .size , (128 , 128 ))
16
16
self .assertEqual (im .format , "PPM" )
17
+ self .assertEqual (im .get_format_mimetype (), "image/x-portable-pixmap" )
17
18
18
19
def test_16bit_pgm (self ):
19
20
im = Image .open ('Tests/images/16_bit_binary.pgm' )
20
21
im .load ()
21
22
self .assertEqual (im .mode , 'I' )
22
23
self .assertEqual (im .size , (20 , 100 ))
24
+ self .assertEqual (im .get_format_mimetype (), "image/x-portable-graymap" )
23
25
24
26
tgt = Image .open ('Tests/images/16_bit_binary_pgm.png' )
25
27
self .assert_image_equal (im , tgt )
@@ -59,3 +61,16 @@ def test_neg_ppm(self):
59
61
60
62
with self .assertRaises (IOError ):
61
63
Image .open ('Tests/images/negative_size.ppm' )
64
+
65
+ def test_mimetypes (self ):
66
+ path = self .tempfile ('temp.pgm' )
67
+
68
+ with open (path , 'w' ) as f :
69
+ f .write ("P4\n 128 128\n 255" )
70
+ im = Image .open (path )
71
+ self .assertEqual (im .get_format_mimetype (), "image/x-portable-bitmap" )
72
+
73
+ with open (path , 'w' ) as f :
74
+ f .write ("PyCMYK\n 128 128\n 255" )
75
+ im = Image .open (path )
76
+ self .assertEqual (im .get_format_mimetype (), "image/x-portable-anymap" )
0 commit comments