Wand colorize() function – Python
Last Updated :
18 Oct, 2021
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:
from wand.image import Image
with Image(filename = "koala.jpeg" ) as img:
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
with Image(filename = "koala.jpeg" ) as img:
img.colorize(color = "yellow" , alpha = "rgb(25 %, 0 %, 20 %)" )
img.save(filename = "colorizedkoala2.jpeg" )
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...