Skip to content
Related Articles

Related Articles

Wand solarize() function in Python

View Discussion
Improve Article
Save Article
  • Last Updated : 08 May, 2020
View Discussion
Improve Article
Save Article

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:


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!