Discuss / Python / 交作业

交作业

Topic source
def bmp_info(data):
	if (len(data) >= 30) & (b'BM' in data):
		data = data[:30]
	else:
		return print('This file is not bmp')
	data_info = struct.unpack('<ccIIIIIIHH',data)
	return {
		'width': data_info[-4],
		'height': data_info[-3],
		'color': data_info[-1]
	}

  • 1

Reply