Discuss / Python / 作业

作业

Topic source

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

def bmp_info(data):

    b_info = struct.unpack('<ccIIIIIIHH', bmp_data[:30])

    d = {'isBMP':False,'width':None,'height':None,'color':None}

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

        d['isBMP'] = True

        d['width'] = b_info[6]

        d['height'] = b_info[7]

        d['color'] = b_info[9]

    return d


  • 1

Reply