Skip to content
Related Articles

Related Articles

Improve Article

Wand tint() function in Python

  • Last Updated : 08 May, 2020

tint() function colorizes midtones of an image by blending the given color. The alpha parameter controls how the blend is effected between color channels. However, this can be tricky to use, so when in doubt, use a alpha=”gray(50)” argument.

Syntax :

wand.image.tint(color, alpha)

Parameters :

ParameterInput TypeDescription
colorColorColor to calculate midtone.
alphaColorDetermine how to blend.

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:
  
    # tinted image using tint() function
    img.tint(color ="yellow", alpha ="rgb(40 %, 60 %, 80 %)")
    img.save(filename ="tintkoala.jpeg")

Output:

Example 2: Increasing amount value




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
  
    # implode imagefx using implode() function
    img.tint(color ="green", alpha ="rgb(10 %, 20 %, 40 %)")
    img.save(filename ="tint2.jpeg")

Output:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :