mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
SF #75103: imghdr -- identify JPEGs in EXIF format
This commit is contained in:
parent
dd3e6cb213
commit
97db05de3e
3 changed files with 12 additions and 1 deletions
|
|
@ -31,11 +31,13 @@ return value from \function{what()}:
|
||||||
\lineii{'tiff'}{TIFF Files}
|
\lineii{'tiff'}{TIFF Files}
|
||||||
\lineii{'rast'}{Sun Raster Files}
|
\lineii{'rast'}{Sun Raster Files}
|
||||||
\lineii{'xbm'}{X Bitmap 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{'bmp'}{BMP files}
|
||||||
\lineii{'png'}{Portable Network Graphics}
|
\lineii{'png'}{Portable Network Graphics}
|
||||||
\end{tableii}
|
\end{tableii}
|
||||||
|
|
||||||
|
\versionadded[Exif detection]{2.5}
|
||||||
|
|
||||||
You can extend the list of file types \module{imghdr} can recognize by
|
You can extend the list of file types \module{imghdr} can recognize by
|
||||||
appending to this variable:
|
appending to this variable:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,13 @@ def test_jpeg(h, f):
|
||||||
|
|
||||||
tests.append(test_jpeg)
|
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):
|
def test_bmp(h, f):
|
||||||
if h[:2] == 'BM':
|
if h[:2] == 'BM':
|
||||||
return 'bmp'
|
return 'bmp'
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ Extension Modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- The imghdr module now detects Exif files.
|
||||||
|
|
||||||
- StringIO.truncate() now correctly adjusts the size attribute.
|
- StringIO.truncate() now correctly adjusts the size attribute.
|
||||||
(Bug #951915).
|
(Bug #951915).
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue