summaryrefslogtreecommitdiffstats
path: root/Lib/imghdr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-04-11 18:59:38 (GMT)
committerGuido van Rossum <guido@python.org>1997-04-11 18:59:38 (GMT)
commit9e3307494d1e35ad21692a6d275f9719697cc420 (patch)
tree71ff83f4cf96e6695916b41706cb05012d9e6a93 /Lib/imghdr.py
parent3d82972b855a5fb8724bc27aae561beda3266399 (diff)
downloadcpython-9e3307494d1e35ad21692a6d275f9719697cc420.zip
cpython-9e3307494d1e35ad21692a6d275f9719697cc420.tar.gz
cpython-9e3307494d1e35ad21692a6d275f9719697cc420.tar.bz2
(Jack:) Recognize PNG files.
Diffstat (limited to 'Lib/imghdr.py')
-rw-r--r--Lib/imghdr.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/imghdr.py b/Lib/imghdr.py
index f3137c5..c320594 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 #
#--------------------#