File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,11 +31,13 @@ \section{\module{imghdr} ---
3131 \lineii {'tiff'}{TIFF Files}
3232 \lineii {'rast'}{Sun Raster Files}
3333 \lineii {'xbm'}{X Bitmap Files}
34- \lineii {'jpeg'}{JPEG data in JFIF format }
34+ \lineii {'jpeg'}{JPEG data in JFIF or Exif formats }
3535 \lineii {'bmp'}{BMP files}
3636 \lineii {'png'}{Portable Network Graphics}
3737\end {tableii }
3838
39+ \versionadded [Exif detection]{2.5}
40+
3941You can extend the list of file types \module {imghdr} can recognize by
4042appending to this variable:
4143
Original file line number Diff line number Diff line change @@ -101,6 +101,13 @@ def test_jpeg(h, f):
101101
102102tests .append (test_jpeg )
103103
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+
104111def test_bmp (h , f ):
105112 if h [:2 ] == 'BM' :
106113 return 'bmp'
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ Extension Modules
3333Library
3434-------
3535
36+ - The imghdr module now detects Exif files.
37+
3638- StringIO.truncate() now correctly adjusts the size attribute.
3739 (Bug #951915).
3840
You can’t perform that action at this time.
0 commit comments