Wand solarize() function in Python
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 :
Parameter Input Type Description threshold numbers.Real between 0.0 and quantum_range./td>
channel basestring Optional 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: