SF #75103: imghdr -- identify JPEGs in EXIF format
authorRaymond Hettinger <python@rcn.com>
Fri, 7 Jan 2005 08:15:41 +0000 (08:15 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 7 Jan 2005 08:15:41 +0000 (08:15 +0000)
Doc/lib/libimghdr.tex
Lib/imghdr.py
Misc/NEWS

index 2f1ac7d9f0f189ba230b43f8abbae7f963a3f6ec..4a4f36855d9b5f49c994819a05112b1ef005aeaa 100644 (file)
@@ -31,11 +31,13 @@ return value from \function{what()}:
   \lineii{'tiff'}{TIFF Files}
   \lineii{'rast'}{Sun Raster Files}
   \lineii{'xbm'}{X Bitmap Files}
-  \lineii{'jpeg'}{JPEG data in JFIF format}
+  \lineii{'jpeg'}{JPEG data in JFIF or Exif formats}
   \lineii{'bmp'}{BMP files}
   \lineii{'png'}{Portable Network Graphics}
 \end{tableii}
 
+\versionadded[Exif detection]{2.5}
+
 You can extend the list of file types \module{imghdr} can recognize by
 appending to this variable:
 
index dc5fb2298014b3593f93cdd8417fbc35a728523b..2fbc9661eb91aea93760826e325aeba2ee8e36e7 100644 (file)
@@ -101,6 +101,13 @@ def test_jpeg(h, f):
 
 tests.append(test_jpeg)
 
+def test_exif(h, f):
+    """JPEG data in Exif format"""
+    if h[6:10] == 'Exif':
+        return 'jpeg'
+
+tests.append(test_exif)
+
 def test_bmp(h, f):
     if h[:2] == 'BM':
         return 'bmp'
index eb40d97b30ce48577ce7d425752f07208c660bf9..d7b35d51678294e276e5a0608951170cf79e87bf 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,8 @@ Extension Modules
 Library
 -------
 
+- The imghdr module now detects Exif files.
+
 - StringIO.truncate() now correctly adjusts the size attribute.
   (Bug #951915).