Wand path_finish() function in Python
Last Updated :
11 May, 2020
Another vital function for paths in wand is python_finish(). As python_start() initiate the path and it is very important to terminate the path also, the path_finish() function handles the termination of the current path.
Syntax: wand.drawing.path_finish()
Example 1:
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
with Drawing() as draw:
draw.stroke_width = 2
draw.stroke_color = Color( 'black' )
draw.path_start()
draw.path_move(to = ( 10 , 10 ))
draw.path_horizontal_line( 100 )
draw.path_finish()
with Image(width = 200 ,
height = 200 ,
background = Color( 'lightgreen' )) as image:
draw(image)
image.save(filename = "pathfinish.png" )
|
Output Image:
Example 2:
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
with Drawing() as draw:
draw.stroke_width = 2
draw.stroke_color = Color( 'black' )
draw.fill_color = Color( 'white' )
draw.path_start()
draw.path_move(to = ( 10 , 10 ))
draw.path_vertical_line( 50 )
draw.path_horizontal_line( 50 )
draw.path_vertical_line( 100 )
draw.path_horizontal_line( 100 )
draw.path_finish()
with Image(width = 200 ,
height = 200 ,
background = Color( 'lightgreen' )) as image:
draw(image)
image.save(filename = "pathfinish.png" )
|
Output Image:
Share your thoughts in the comments
Please Login to comment...