Discuss / Python / struct

struct

Topic source

遥望君山

#1 Created at ... [Delete] [Delete and Lock User]
def bmp_info(data):
    info = struct.unpack('<ccIIIIIIHH', data[:30])
    assert (b'B', b'M') == (info[0], info[1])
    return {
        'width': info[6],
        'height': info[7],
        'color': info[9]
    }

  • 1

Reply