Thursday, September 4, 2025
HomeLanguagesWand colorize() function – Python

Wand colorize() function – Python

Colorized Image refers to image that is blended with a particular color. In order to generate a colorized image we use colorize() function in python Wand. colorize() function blends an image with a constant color. It takes two parameters color and alpha.

Syntax :

wand.image.colorize(color, alpha)

Parameters :

Parameter Input Type Description
color wand.color.Color Color to paint image with.
alpha wand.color.Color Defines how to blend color.

Source Image:

Example 1:




# import Image with wand.image module
from wand.image import Image
  
# read image using Image() function
with Image(filename ="koala.jpeg") as img:
    # generate colorized image
    img.colorize(color ="yellow", alpha ="rgb(10 %, 0 %, 20 %)")
    img.save(filename ="colorizedkoala.jpeg")


Output:

Example 2:
Increase value of alpha.




from wand.image import Image
  
# read image using Image() function
with Image(filename ="koala.jpeg") as img:
    # generate colorized image
    img.colorize(color ="yellow", alpha ="rgb(25 %, 0 %, 20 %)")
    img.save(filename ="colorizedkoala2.jpeg")


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6629 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11858 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6716 POSTS0 COMMENTS