我目前正在製作一個程序,它將信息呈現給緩衝區,並且我想將信息保存爲某種圖像文件到我的工作目錄。我見過一些使用PIL的例子,但是python 3.x不支持該庫。有更好的選擇嗎?在python 3.x中創建,修改和保存圖像
1
A
回答
0
先卸載PIL比安裝Pillow
其一個PIL的克隆,其對Python的3.x的工作
from PIL import Image
img = Image.open("test1.jpg") #jpg, png, etc.
pix = img.load()
print img.size #Get the width and height of the image for iterating over
print pix[15,15] #Get the RGBA Value of the a pixel of an image
pix[15, 15] = value # Set the RGBA Value of the image (tuple)
img.save("out.jpg") # Saves the modified pixels to image
相關問題
- 1. 從字節創建和保存圖像[]
- 2. Swift 3 - 保存圖像更改RGB值
- 3. 在FTP上保存創建的圖像?
- 4. Python/Django下載從URL的圖像,修改,並保存到ImageField
- 5. 保存圖表創建圖像列表
- 6. 修改Linux文件,並在Python保存
- 7. 在python中創建保存功能
- 8. 在Python中修改x日期標籤
- 9. 在python中保存圖像3.1
- 10. 在Linux中創建和修改VDI磁盤映像的內容
- 11. python-3.x酸洗創建空文件
- 12. 如何保存自定義日期時間在cakephp 3中創建和修改字段?
- 13. 使用tikinter在Python中創建輸入表並保存更改
- 14. 在Tkinter中修改窗口類(Python 3)
- 15. 修改x和yrange?
- 16. 有肖像保存修改後的值
- 17. python硒保存圖像空
- 18. Python - 保存url的圖像
- 19. Python PIL圖像保存
- 20. 在python中創建圖像表
- 21. 如何在python中創建cmyk圖像
- 22. 在opencv python中創建透明圖像
- 23. Python 3.x和SFTP
- 24. Boost和Python 3.x
- 25. 在XNA中創建和保存貼圖地圖
- 26. 在Python中創建向前兼容的OpenGL 3.x上下文
- 27. 創建一個會話保存在Python
- 28. 在Silverlight 3中修剪圖像
- 29. 創建保存對象後無法修改的mongoid字段?
- 30. 使用Python修改並創建PDF
試試PIL的克隆,[Pillow](https://pypi.python.org/pypi/Pillow)。它有一個3.X分支,最後我檢查了一下。 – Kevin
是的,凱文是對的。我使用Pillow來處理3.x中的所有圖像處理需求。 – BlivetWidget
奇怪,我通過pip安裝了枕頭,但是我無法將它導入python命令行。點子列表顯示Pillow已安裝。 – Maurdekye