Python中的魔杖翻转()函数
在本文中,我们将学习什么是翻转()函数。基本上这个函数返回一个翻转的图像。翻转效果将图像倒置或创建图像的垂直反射。此函数中不需要任何参数。
Syntax : wand.image.flip()
Parameters : No Parameters in flip() function.
源图像:
示例 1:
Python3
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
with img.clone() as fimg:
# flip image using flip() function
fimg.flip()
fimg.save(filename ='koalaflipped.jpeg')
Python3
from wand.image import Image
# Read image using Image function
with Image(filename ="man.jpeg") as img:
with img.clone() as fimg:
# flip image using flip() function
fimg.flip()
fimg.save(filename ='manflipped.jpeg')
输出:
示例 2:
源图像:
Python3
from wand.image import Image
# Read image using Image function
with Image(filename ="man.jpeg") as img:
with img.clone() as fimg:
# flip image using flip() function
fimg.flip()
fimg.save(filename ='manflipped.jpeg')
输出: