Skip to content
Related Articles

Related Articles

Improve Article

Wand gamma() function in Python

  • Last Updated : 10 May, 2020

gamma() allows us to adjust the luminance of an image. Resulting pixels are defined as pixel^(1/gamma). The value of gamma is typically between 0.8 & 2.3 range, and value of 1.0 will not affect the resulting image.

Parameters :

ParameterInput TypeDescription
adjustment_valuenumbers.Realvalue to adjust gamma level.
channelbasestringoptional channel to apply gamma correction.
Example:

Source Image:




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
    img.gamma(1.35)
    img.save(filename ="kl-gamma.jpeg")

Output :



Example 2: Increasing adjustment_value to 1.75.




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
    img.gamma(1.75)
    img.save(filename ="kl-gamma2.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 :