arc()是wand.drawing模块中存在的函数。 arc()函数在图像中绘制圆弧。您需要定义三对(x,y)坐标。第一对和第二对坐标将是最小边界矩形,最后一对将定义开始和结束度。
用法:
wand.drawing.arc(start, end, degree)
参数:
参数 | 输入类型 | 描述 |
---|---|---|
start | 序列或(数字。实数,数字。实数) | 表示弧的x和y的起点。 |
end | 序列或(数字。实数,数字。实数) | 表示圆弧的x和y的终点。 |
degree | 序列或(数字。实数,数字。实数) | 代表开始程度和结束程度的对 |
范例1:
# Import required objects from wand modules
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
# generate object for wand.drawing
with Drawing() as draw:
# set stroke color
draw.stroke_color = Color('black')
# set width for stroke
draw.stroke_width = 1
# fill white color in arc
draw.fill_color = Color('white')
draw.arc(( 50, 50), # Stating point
( 150, 150), # Ending point
(135, -45)) # From bottom left around to top right
with Image(width = 100,
height = 100,
background = Color('green')) as img:
# draw shape on image using draw() function
draw.draw(img)
img.save(filename ='arc.png')
输出:
范例2:
源图像:
# Import required objects from wand modules
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
# generate object for wand.drawing
with Drawing() as draw:'
# set stroke color
draw.stroke_color = Color('black')
# set width for stroke
draw.stroke_width = 1
# fill white color in arc
draw.fill_color = Color('white')
draw.arc(( 50, 50), # Stating point
( 150, 150), # Ending point
(135, -45)) # From bottom left around to top right
with Image(filename ="gog.png") as img:
# draw shape on image using draw() function
draw.draw(img)
img.save(filename ='arc.png')
输出:
相关用法
- Python bokeh.plotting.figure.arc()用法及代码示例
- Python PIL ImageDraw.Draw.arc()用法及代码示例
- Python Wand function()用法及代码示例
- Python Wand gaussian_blur()用法及代码示例
- Python Wand transform()用法及代码示例
- Python Wand crop()用法及代码示例
- Python Wand rotational_blur()用法及代码示例
- Python Wand Image()用法及代码示例
- Python Wand shade()用法及代码示例
- Python Wand sharpen()用法及代码示例
- Python Wand adaptive_sharpen()用法及代码示例
- Python Wand noise()用法及代码示例
- Python Wand blue_shift()用法及代码示例
注:本文由纯净天空筛选整理自RahulSabharwal大神的英文原创作品 Wand arc() function in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。