我目前正在制作一个程序,它将信息呈现给缓冲区,并且我想将信息保存为某种图像文件到我的工作目录。我见过一些使用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