Wand bezier() function in Python
The bezier() is another Drawing function in Wand. This method is used to draw a bezier curve. It requires four points to determine a bezier curve. Extreme points define the start and end of the curve while in between two points are used to control the curve.
Syntax: wand.drawing.bezier(points)
Parameters :
Parameter |
Input Type |
Description |
points |
list |
list of x, y tuples. |
Example 1:
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
with Drawing() as draw:
draw.stroke_color = Color( 'black' )
draw.stroke_width = 1
points = [( 40 , 10 ),
( 20 , 50 ),
( 90 , 10 ),
( 70 , 40 )]
draw.fill_color = Color( 'white' )
draw.bezier(points)
with Image(width = 100 ,
height = 100 ,
background = Color( 'green' )) as img:
draw.draw(img)
img.save(filename = 'bezier.png' )
|
Output:
Example #2:
Input Image:
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
with Drawing() as draw:
points = [( 20 , 100 ),
( 50 , 10 ),
( 50 , 90 ),
( 180 , 100 )]
draw.stroke_color = Color( 'black' )
draw.stroke_width = 1
draw.fill_color = Color( 'white' )
draw.bezier(points)
with Image(filename = "gog.png" ) as img:
draw.draw(img)
img.save(filename = 'bezier2.png' )
|
Output:
Last Updated :
11 May, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...