Pgmagick 剪切()方法 - Python
Shear ()函数是 Pgmagick 库中的一个内置函数,用于沿 X 或 Y 轴滑动图像的一个边缘以创建平行四边形。 X 方向剪切沿 X 轴滑动边缘,而 Y 方向剪切沿 Y 轴滑动边缘。剪切角用于设置图像的剪切。
Syntax:
Parameters: This function accepts two parameters as mentioned above and described below:
- x: This parameter is used to set degrees to x-shear of the image.
- y: This parameter is used to set degrees to y-shear of the image.
Return Value: This function returns the Pgmagick object with image added.
输入图像:
shear(x, y)
输出:
示例 2:
from pgmagick import Image, DrawableCircle, DrawableText
from pgmagick import Geometry, Color
# draw the image of dimension 600 * 600
img = Image('input.png')
# invoke shear function with width as 30, height as 40 and Percentage as True
img.shear(30, 40)
# invoke write function along with filename
img.write('2_a.png')
输出: