def bmp_info(data):
data_1 = struct.unpack('<ccIIIIIIHH', data[:30])
if data_1[:2] == (b'B', b'M'):
return{
'width': data_1[-4],
'height': data_1[-3],
'color': data_1[-1]
}
else:
print('不是位图文件。')
强,学到了
Sign in to make a reply
Meng。
def bmp_info(data):
data_1 = struct.unpack('<ccIIIIIIHH', data[:30])
if data_1[:2] == (b'B', b'M'):
return{
'width': data_1[-4],
'height': data_1[-3],
'color': data_1[-1]
}
else:
print('不是位图文件。')