diff -r f1f707dd7cae Doc/library/imghdr.rst --- a/Doc/library/imghdr.rst Wed Jan 08 16:01:42 2014 +0100 +++ b/Doc/library/imghdr.rst Wed Jan 08 13:27:25 2014 -0800 @@ -48,6 +48,8 @@ +------------+-----------------------------------+ | ``'png'`` | Portable Network Graphics | +------------+-----------------------------------+ +| ``'webp'`` | WebP files | ++------------+-----------------------------------+ You can extend the list of file types :mod:`imghdr` can recognize by appending to this variable: diff -r f1f707dd7cae Lib/imghdr.py --- a/Lib/imghdr.py Wed Jan 08 16:01:42 2014 +0100 +++ b/Lib/imghdr.py Wed Jan 08 13:27:25 2014 -0800 @@ -112,6 +112,12 @@ tests.append(test_bmp) +def test_webp(h, f): + if h.startswith(b'RIFF') and h[8:12] == b'WEBP': + return 'webp' + +tests.append(test_webp) + #--------------------# # Small test program # #--------------------#