Discuss / Python / 打印出位图的图片大小和颜色数。

打印出位图的图片大小和颜色数。

Topic source

灿_Clarence

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

def bmp_info(data):

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

    if s[1] == b'M':

        return {

        'width':  s[6],

        'height': s[7],

        'color': s[9]

        }


  • 1

Reply