def bmp_info(data):
a = struct.unpack('<ccIIIIIIHH', data[:30])
b = {}
if a[0] == b'B' and a[1] == b'M':
b['width'] = a[6]
b['height'] = a[7]
b['color'] = a[9]
return b
else:
return('not a bmp file!')
Sign in to make a reply
Will就是Stone
def bmp_info(data):
a = struct.unpack('<ccIIIIIIHH', data[:30])
b = {}
if a[0] == b'B' and a[1] == b'M':
b['width'] = a[6]
b['height'] = a[7]
b['color'] = a[9]
return b
else:
return('not a bmp file!')