本文主要是介绍使用Python进行图片格式转化/分辨率转化,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一.下载python PIY插件库
PIP下载命令: pip install pillow -i https://mirrors.aliyun.com/pypi/simple
PIY插件库:pillow Installation - Pillow (PIL Fork) 10.3.0.dev0 documentation
二.分辨率转化
from PIL import Image
import osresolution = (1024, 1024)
with Image.open("spyglass.png") as img:img_resized = img.resize(resolution)img_resized.save("spyglass.png")
这篇关于使用Python进行图片格式转化/分辨率转化的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!