From: Guido van Rossum Date: Fri, 11 Apr 1997 18:59:38 +0000 (+0000) Subject: (Jack:) Recognize PNG files. X-Git-Tag: v1.5a1~172 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e3307494d1e35ad21692a6d275f9719697cc420;p=thirdparty%2FPython%2Fcpython.git (Jack:) Recognize PNG files. --- diff --git a/Lib/imghdr.py b/Lib/imghdr.py index f3137c5afb04..c320594e9762 100644 --- a/Lib/imghdr.py +++ b/Lib/imghdr.py @@ -94,6 +94,18 @@ def test_jpeg(h, f): tests.append(test_jpeg) +def test_bmp(h, f): + if h[:2] == 'BM': + return 'bmp' + +tests.append(test_bmp) + +def test_png(h, f): + if h[:8] == "\211PNG\r\n\032\n": + return 'png' + +tests.append(test_png) + #--------------------# # Small test program # #--------------------#