Recognize EMF images

This commit is contained in:
Kovid Goyal 2013-09-13 15:17:09 +05:30
parent 1ebb8a64ee
commit 5271d1a2e1

View File

@ -10,10 +10,10 @@ def what(file, h=None):
if h is None:
if isinstance(file, basestring):
f = open(file, 'rb')
h = f.read(32)
h = f.read(44)
else:
location = file.tell()
h = file.read(32)
h = file.read(44)
file.seek(location)
f = None
else:
@ -120,6 +120,12 @@ def test_bmp(h, f):
tests.append(test_bmp)
def test_emf(h, f):
if h[:4] == b'\x01\0\0\0' and h[40:44] == b' EMF':
return 'emf'
tests.append(test_emf)
#--------------------#
# Small test program #
#--------------------#