Wednesday, July 3, 2024
HomeLanguagesPythonPython – charcoal() method in Wand

Python – charcoal() method in Wand

charcoal() generates a sketch kind of image of original image. A very similar image to edge extraction is generated with inverted colours. One of the artistic simulations, charcoal() can emulate a drawing on paper.

Syntax :

wand.image.charcoal(radius, sigma)

Parameters :

Parameter Input Type Description
radius numbers.Real The size of the Gaussian operator.
sigma numbers.Real The standard deviation of the Gaussian.

Source Image:

Example 1:




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
  
    # Charcoal fx using charcoal() function
    img.charcoal(radius = 1.5, sigma = 0.5)
    img.save(filename ="ch_koala.jpeg")


Output:

Example 2: Increasing radius and sigma value.




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
  
    # Charcoal fx using charcoal() function
    img.charcoal(radius = 4, sigma = 0.65)
    img.save(filename ="ch_koala_2.jpeg")


Output:

Thapelo Manthata
I’m a desktop support specialist transitioning into a SharePoint developer role by day and Software Engineering student by night. My superpowers include customer service, coding, the Microsoft office 365 suite including SharePoint and power platform.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments