Discuss / Python / 严格判断用B、M、恒0位、恒1位

严格判断用B、M、恒0位、恒1位

Topic source

子鱼若鱼

#1 Created at ... [Delete] [Delete and Lock User]

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


  • 1

Reply