Wand sketch() function in Python (original) (raw)
Last Updated : 25 Apr, 2025
Sketch is another artistic special effect present in Wand library in python. sketch() function generates a pencil sketched image in output.For best results, radius value should be larger than sigma.
Syntax :
Python3 `
wand.image.sketch( radius, sigma, angle)
radius should always be greater than sigma(standard deviation)
`
Parameter :
Parameter Input Type Description radius numbers.Real Size of Gaussian aperture. sigma numbers.Real standard deviation of the Gaussian operator. angle numbers.Real direction of blur.
Source Image:
Example #1:
Python3 `
import display() to show final image
from wand.display import display
import Image from wand.image module
from wand.image import Image
read file using Image function
with Image(filename ="koala.jpeg") as img:
# generate pencil sketch image using sketch() function
img.sketch(0.5, 0.0, 98.0)
# save final image
img.save(filename ="rb_koala.jpeg")
# display final image
display(img)
`
Output :
Example #2: To get the best result transform image to grayscale image
Python3 `
import display() to show final image
from wand.display import display
import Image from wand.image module
from wand.image import Image
read file using Image function
with Image(filename ="koala.jpeg") as img:
# transform to grayscale image
img.transform_colorspace("gray")
# generate pencil sketch image using sketch() function
img.sketch(0.5, 0.0, 98.0)
# save final image
img.save(filename ="rb_koala.jpeg")
# display final image
display(img)
`
Output :
Similar Reads
- Wand sketch() function - Python The sketch() function is an inbuilt function in the Python Wand ImageMagick library which is used to simulate a pencil sketch effect. Syntax: sketch(radius, sigma, angle) Parameters: This function accepts three parameters as mentioned above and defined below: radius: This parameter stores the radius 2 min read
- Wand text() function in Python Text can also be added using wand.drawing object. text() function is used to add text in the Drawing object. It takes x and y coordinates and string that we want to write on (x, y) position. Syntax : wand.drawing.text(x, y, body) Parameters : ParameterInput TypeDescriptionxnumbers.Integralthe baseli 1 min read
- Python - shade() function in Wand shade() function generates a 3d kind of image or creates a 3d effect by simulating a light from an elevated angle. azimuth parameter is used to control the X and Y angle and elevation parameter is used to control the z angle of the image. We can also get final image in grayscale by putting gray para 1 min read
- Wand resize() function in Python Resize image refers to change dimensions of original image in order to convert original image in dimensions that are perfect to use.Scaling Down refers to decrease dimensions of images and make image size smaller. While Scaling Up refers to increase dimensions of an image, and making image size larg 2 min read
- Wand statistic() function in Python Statistic effect is similar to Spread effect, the only difference is that, it replaces each pixel with the result of a mathematical operation performed against neighboring pixel values.The width & height defines the size, or aperture, of the neighboring pixels. The type of statistic operations c 1 min read
- Python - sharpen() function in Wand sharpen() function is used in order to enhance blurry edges into more distinct(sharp) edges. This is achieved using a Gaussian function. The radius value should always less than the standard deviation(sigma). Sharpen effect image more clearer and defined. Syntax : wand.image.sharpen(radius, sigma, c 1 min read
- Wand rectangle() function in Python rectangle() function, as the name describes this function is used to draw a circle using wand.drawing object in Python. rectangle takes many arguments like left, top, right, bottom, width, height etc. Syntax : wand.drawing.rectangle(left, top, right, bottom, width, height, radius, xradius, yradius) 2 min read
- Wand shave() function - Python The shave() function is an inbuilt function in the Python Wand ImageMagick library which is used to remove pixels from the image. Syntax: shave(columns, rows) Parameters: This function accepts four parameters as mentioned above and defined below: columns: This parameter is used to set amount to shav 2 min read
- Wand shade() function - Python The shade() function is an inbuilt function in the Python Wand ImageMagick library which is used to generates create a 3D effect by simulating a light from an elevated angle. Syntax: shade(gray, azimuth, elevation) Parameters: This function accepts three parameters as mentioned above and defined bel 2 min read
- Wand scale() function - Python The scale() function is an inbuilt function in the Python Wand ImageMagick library which is used to change the image size by scaling each pixel value by given columns and rows. Syntax: scale(columns, rows) Parameters: This function accepts two parameters as mentioned above and defined below: columns 2 min read