def bmp_info(data): t = struct.unpack('<ccIIIIIIHH', data[:30]) if t[0] == b'B' and t[1] == b'M' and t[3] == 0 and t[8] == 1: return { 'width': t[6], 'height': t[7], 'color': t[9] } else : return None
Sign in to make a reply
子鱼若鱼
def bmp_info(data): t = struct.unpack('<ccIIIIIIHH', data[:30]) if t[0] == b'B' and t[1] == b'M' and t[3] == 0 and t[8] == 1: return { 'width': t[6], 'height': t[7], 'color': t[9] } else : return None