python Pil byteio轉換
讀取需要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)
pil time 0.01399993896484375 0.01900196075439453
read io time 0.0
pil time 0.0009675025939941406 0.017029523849487305
read io time 0.0
pil time 0.0 0.018001794815063477
read io time 0.000997781753540039
pil time 0.0 0.017999887466430664
read io time 0.0
pil time 0.0010001659393310547 0.01703047752380371
read io time 0.0010001659393310547
pil time 0.0 0.017999887466430664
read io time 0.0009694099426269531
pil time 0.0 0.019000530242919922
read io time 0.0
pil time 0.0009999275207519531 0.01799941062927246
read io time 0.0
pil time 0.0010330677032470703 0.017968416213989258
read io time 0.0
pil time 0.0009996891021728516 0.018031597137451172
read io time 0.0
相關文章
- python base64 編解碼,轉換成Opencv,PIL.Image圖片格式PythonOpenCV
- python pil resize 用法Python
- PIL影像轉torch的tensor
- Python影像處理庫——PILPython
- 基於Python PIL實現簡單圖片格式轉化器Python
- [Python] 各種轉換Python
- python opencv轉換bytesioPythonOpenCV
- 【python】進位制轉換Python
- python PIL 開啟\顯示\儲存影像Python
- 將json資料轉換為Python字典將json資料轉換為Python字典JSONPython
- python hex轉ascii轉換Python程式碼的簡單方法PythonASCII
- Python 輕量化簡繁轉換Python
- Python的OpenCV轉換影像大小PythonOpenCV
- PIL Image
- python中無法引入pil怎麼解決Python
- python str與byte轉換 encode decodePython
- 【python】str與json型別轉換PythonJSON型別
- Python中CSV讀取和轉換Python
- python實現中文和unicode轉換PythonUnicode
- Python數字轉換中文大寫Python
- python實現字串轉換整數Python字串
- python將tif投影轉換至basemapPython
- Python中各進位制轉換Python
- python中time.mktime()的轉換Python
- python字串轉換為日期時間Python字串
- Python pytorch 座標系變換與維度轉換PythonPyTorch
- python--進位制轉換和資料交換Python
- Python PIL模組隨機生成中文驗證碼Python隨機
- PIL基礎
- Python將xml格式轉換為json格式PythonXMLJSON
- Python秒轉換成時間(時分秒)Python
- Python3 資料型別轉換Python資料型別
- Python/Java AES 加解密方法互相轉換PythonJava解密
- python str與bytes之間的轉換Python
- Python——格式轉換的學習筆記Python筆記
- python 與 Mysql 資料型別轉換PythonMySQL 資料型別
- Python 編碼轉換與中文處理Python
- 如何用Python把pdf轉換成wordPython