是的,Python的PIL库(Pillow库的升级版)提供了图片旋转功能。你可以使用rotate()
方法来旋转图片。示例如下:
from PIL import Image
# 打开图片文件
image = Image.open('example.jpg')
# 旋转图片90度
rotated_image = image.rotate(90)
# 保存旋转后的图片
rotated_image.save('rotated_example.jpg')
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:python中的image函数如何使用