Pgmagick shade() 方法 – Python
shade()函数是 Pgmagick 库中的一个内置函数,用于使用远处光源对图像进行着色。该函数在成功时返回真值。
Syntax:
Parameters: This function accept two parameters as mentioned above and described below:
- azimuthal angle: This parameter stores the value of the azimuthal angle.
- elevation angle: This parameter stores the value of the elevation angle.
Return Value: This function returns the Pgmagick object with image added.
输入图像:
示例 1:
shade( azimuthal angle, elevation angle )
输出:
示例 2:
from pgmagick import Image, DrawableCircle, DrawableText
from pgmagick import Geometry, Color
# draw the image of dimension 600 * 600
img = Image('input.png')
# invoke shade function with azimuthal angle as 45 and angle of elevation as 90
img.shade(45, 90)
# invoke write function along with filename
img.write('2_a.png')
输出:
在评论中写代码?请使用 ide.geeksforgeeks.org,生成链接并在此处分享链接。