Skip to content
Related Articles

Related Articles

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

Image noise is random variation of brightness or color information in images, and is usually an aspect of electronic noise. We can add noise to the image using noise() function. noise function can be useful when applied before a blur operation to defuse an image.

Following are the noise we can add using noise() function:

  • gaussian
  • impulse
  • laplacian
  • multiplicative_gaussian
  • poisson
  • random
  • uniform

Syntax :

wand.image.noise(noise_type, attenuate, channel)

Parameters :

ParameterInput TypeDescription
noise_typenumbers.RealType of noise to apply.
attenuatenumbers.RealRate of distribution. Only available in ImageMagick-7. Default is 1.0.
channelbasestringOptionally target a color channel to apply noise to.

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:
  
    # Generate noise image using spread() function
    img.noise("poisson", attenuate = 0.9)
    img.save(filename ="noisekoala.jpeg")

Output:

Example 2:




# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image() function
with Image(filename ="koala.jpeg") as img:
  
    # Generate noise image using spread() function
    img.noise("laplacian", attenuate = 1.0)
    img.save(filename ="noisekoala2.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 :