def bmp_info(data): t = struct.unpack('<ccIIIIIIHH', data[:30]) if t[0] == b'B' and (t[1]==b'A' or t[1]==b'M'): return { 'width': t[6], 'height': t[7], 'color': t[9] } else: print('not bmp')
Sign in to make a reply
阿萌QVQ
def bmp_info(data): t = struct.unpack('<ccIIIIIIHH', data[:30]) if t[0] == b'B' and (t[1]==b'A' or t[1]==b'M'): return { 'width': t[6], 'height': t[7], 'color': t[9] } else: print('not bmp')