使用Pillow对图像进行变换
from PIL import Image, ImageEnhance
# 原图
image = Image.open("1.jpg")
image.show()
# 镜像
mirrored_image = image.transpose(Image.FLIP_LEFT_RIGHT)
mirrored_image.show()
mirrored_image.save('mirror_image.jpg')
# 旋转
rotated_image = image.rotate(45)
rotated_image.show()
rotated_image.save('rotated_image.jpg')
# 亮度增强
brightness_enhancer = ImageEnhance.Brightness(image) # 创建图像增强对象
brighter_image = brightness_enhancer.enhance(factor=1.5)
brighter_image.show()
brighter_image.save('brighter_image.jpg')