读取需要1ms不到,
转换byteio,BMP17ms,PNG1百多ms,Jpeg需要25ms
这个还能还原回来
from PIL import Image
def a():
path='d:/1.jpg'
for i in range(10):
start=time.time()
roiImg=Image.open(path)
read_time=time.time()-start
start = time.time()
imgByteArr = io.BytesIO()
roiImg.save(imgByteArr, format='BMP')
# roiImg.save(imgByteArr, format='Jpeg')
# imgByteArr = imgByteArr.getvalue()
print('pil time',read_time,time.time()-start)
start = time.time()
img=Image.open(imgByteArr)
print('read io time', time.time() - start)
</