mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Recognize EMF images
This commit is contained in:
parent
1ebb8a64ee
commit
5271d1a2e1
@ -10,10 +10,10 @@ def what(file, h=None):
|
|||||||
if h is None:
|
if h is None:
|
||||||
if isinstance(file, basestring):
|
if isinstance(file, basestring):
|
||||||
f = open(file, 'rb')
|
f = open(file, 'rb')
|
||||||
h = f.read(32)
|
h = f.read(44)
|
||||||
else:
|
else:
|
||||||
location = file.tell()
|
location = file.tell()
|
||||||
h = file.read(32)
|
h = file.read(44)
|
||||||
file.seek(location)
|
file.seek(location)
|
||||||
f = None
|
f = None
|
||||||
else:
|
else:
|
||||||
@ -120,6 +120,12 @@ def test_bmp(h, f):
|
|||||||
|
|
||||||
tests.append(test_bmp)
|
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 #
|
# Small test program #
|
||||||
#--------------------#
|
#--------------------#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user