Skip to content
Related Articles

Related Articles

Improve Article
Wand solarize() function in Python
  • Last Updated : 08 May, 2020

Solarize Effect is the effect of tone reversal observed in cases of extreme overexposure of the photographic film in the camera. Most likely, the effect was first observed in scenery photographs including the sun (e.q. sol, sun). The sun, instead of being the whitest spot in the image, turned black or grey. solarize() function creates a “burned” effect on the image by replacing pixel values above a defined threshold with a negated value.

Syntax :

wand.image.solarize(amount, method)

Parameters :

ParameterInput TypeDescription
thresholdnumbers.Realbetween 0.0 and quantum_range./td>
channelbasestringOptional color channel to target. See CHANNELS

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:
  
    # solarized image using solarize() function
    img.solarize(threshold = 0.5 * img.quantum_range)
    img.save(filename ="solpkoala.jpeg")

Output :

Example 2:
Decreasing threshold value.




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
  
    # solarized image using solarize() function
    img.solarize(threshold = 0.25 * img.quantum_range)
    img.save(filename ="impkoala2.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 :