图像旋转与格式转换
1 from PIL import Image 2 img1 = Image.open(r'C:\Users\87823\Desktop\tree.png') 3 img1.rotate(90).show()
1 from PIL import Image 2 img1 = Image.open(r'C:\Users\87823\Desktop\tree.png') 3 # 图像旋转 4 #img1.rotate(90).show() 5 6 # 格式转换 7 img1.transpose(Image.FLIP_TOP_BOTTOM).show() # 上下滤镜 8 img1.transpose(Image.FLIP_LEFT_RIGHT).show() # 左右滤镜 9 img.transpose(Image.ROTATE_90).show()
正是江南好风景