[英]Save image in python 3.1
我的緩沖區中有圖像數據,我想通過不使用庫將圖像保存在計算機中。 (我使用python 3.1)非常感謝。
好的,在python 3.x中,內置的open
函數別名為io.open
因此您可以執行此操作(假設您已將圖像數據存儲在imagedata
)
filename = "image.png" # use suitable extension according to the format of the image
f = open(filename, 'w') # first argument is the filename
f.write(imagedate)
f.close()
現在,圖像將以文件名image.png
保存在本地目錄中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.