with open('test.bmp','rb') as fn: fn = fn.read() f = struct.unpack('<ccIIIIIIHH',fn[0:30]) if (f[0] == b'B') & (f[1] == b'M'): print('It\'s Windows BMP file\nhigh:%s weight:%s \nThe Colornumbers:%s' % (f[6],f[7],f[8]))
Sign in to make a reply
執謎卜誤