PPM to JPEG/JPG conversion for Python 3.4.1

断了今生、忘了曾经 提交于 2019-12-07 12:21:12

问题


Does anyone know of any way to convert a ppm file to a jpeg/jpg using python 3.4.1 specifically? I've looked around and can only find solutions for previous version of python.


回答1:


You can use the Pillow module. The following should work:

from PIL import Image

im = Image.open("sweet_pic.ppm")
im.save("sweet_pic.jpg")

Read through the tutorial for more information.



来源:https://stackoverflow.com/questions/26937143/ppm-to-jpeg-jpg-conversion-for-python-3-4-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!