File tree 3 files changed +12
-1
lines changed
3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,13 @@ \section{\module{imghdr} ---
31
31
\lineii {'tiff'}{TIFF Files}
32
32
\lineii {'rast'}{Sun Raster Files}
33
33
\lineii {'xbm'}{X Bitmap Files}
34
- \lineii {'jpeg'}{JPEG data in JFIF format }
34
+ \lineii {'jpeg'}{JPEG data in JFIF or Exif formats }
35
35
\lineii {'bmp'}{BMP files}
36
36
\lineii {'png'}{Portable Network Graphics}
37
37
\end {tableii }
38
38
39
+ \versionadded [Exif detection]{2.5}
40
+
39
41
You can extend the list of file types \module {imghdr} can recognize by
40
42
appending to this variable:
41
43
Original file line number Diff line number Diff line change @@ -101,6 +101,13 @@ def test_jpeg(h, f):
101
101
102
102
tests .append (test_jpeg )
103
103
104
+ def test_exif (h , f ):
105
+ """JPEG data in Exif format"""
106
+ if h [6 :10 ] == 'Exif' :
107
+ return 'jpeg'
108
+
109
+ tests .append (test_exif )
110
+
104
111
def test_bmp (h , f ):
105
112
if h [:2 ] == 'BM' :
106
113
return 'bmp'
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ Extension Modules
33
33
Library
34
34
-------
35
35
36
+ - The imghdr module now detects Exif files.
37
+
36
38
- StringIO.truncate() now correctly adjusts the size attribute.
37
39
(Bug #951915).
38
40
You can’t perform that action at this time.
0 commit comments