Discuss / Python / 打卡

打卡

Topic source

def bmp_info(data):

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

    b = {}

    if a[0] == b'B' and a[1] == b'M':

       b['width'] = a[6]

       b['height'] = a[7]

       b['color'] = a[9]

       return b

    else:

       return('not a bmp file!')


  • 1

Reply