Discuss / Python / daka

def bmp_info(data):

    header=bmp_data[:30]

    all_info=struct.unpack('<ccIIIIIIHH',header)

    if all_info[0]==b'B' and all_info==b'M':

         return {

        'width': all_info[6],

        'height': all_info[7],

        'color': all_info[9]

         }

    return False


  • 1

Reply