diff -r 1469c4fde8cd Doc/library/imghdr.rst --- a/Doc/library/imghdr.rst Sat Jan 18 18:31:41 2014 +0200 +++ b/Doc/library/imghdr.rst Sun Jan 19 21:13:35 2014 +0100 @@ -48,6 +48,11 @@ +------------+-----------------------------------+ | ``'png'`` | Portable Network Graphics | +------------+-----------------------------------+ +| ``'exr'`` | OpenEXR Files | ++------------+-----------------------------------+ + +.. versionadded:: 3.5 + The *exr* format was added. You can extend the list of file types :mod:`imghdr` can recognize by appending to this variable: diff -r 1469c4fde8cd Lib/imghdr.py --- a/Lib/imghdr.py Sat Jan 18 18:31:41 2014 +0200 +++ b/Lib/imghdr.py Sun Jan 19 21:13:35 2014 +0100 @@ -112,6 +112,12 @@ tests.append(test_bmp) +def test_exr(h, f): + if h.startswith(b'\x76\x2f\x31\x01'): + return 'exr' + +tests.append(test_exr) + #--------------------# # Small test program # #--------------------#