def bmp_info(data):
s=struct.unpack('<ccIIIIIIHH',data[0:30])
if s[0:2]==(b'B',b'M') or s[0:2]==(b'B',b'A'):
print('这是一个位图文件')
return {
'width':s[-4],
'height':s[-3],
'color':s[-1]
}
Sign in to make a reply
Shadow丶crown
def bmp_info(data):
s=struct.unpack('<ccIIIIIIHH',data[0:30])
if s[0:2]==(b'B',b'M') or s[0:2]==(b'B',b'A'):
print('这是一个位图文件')
return {
'width':s[-4],
'height':s[-3],
'color':s[-1]
}