import base64, struct
def bmp_info(data): s = data[:30] wa = struct.unpack('<ccIIIIIIHH',s) if wa[0] + wa[1] == b'BM': return { 'width': wa[-4], 'height': wa[-3], 'color': wa[-1] } else: print('打开目标文件错误')
Sign in to make a reply
天命破凰
import base64, struct
def bmp_info(data): s = data[:30] wa = struct.unpack('<ccIIIIIIHH',s) if wa[0] + wa[1] == b'BM': return { 'width': wa[-4], 'height': wa[-3], 'color': wa[-1] } else: print('打开目标文件错误')