Discuss / Python / 打卡

打卡

Topic source

def bmp_info(data):

    s=struct.unpack('<ccIIIIIIHH',data[0:30])

    if s[0:2]==(b'B',b'M') or s[0:2]==(b'B',b'A'):

        print('这是一个位图文件')

        return {

            'width':s[-4],

            'height':s[-3],

            'color':s[-1]

        }


  • 1

Reply