Javatpoint Logo
Javatpoint Logo

Imagick addNoiseImage() Function

The Imagick::addNoiseImage() method is a PHP built-in function for adding noise to a given image. The amount of noise produced is determined by noise constants and channel kinds. The random variation of brightness and contrast in an image is known as image noise.


The following parameters are accepted by this function, as mentioned above and described below:

  • $noise_type: The noise types are selected using this option. The following are some noise constants available in the Imagick function:
    • imagick::NOISE_UNIFORM (int)
    • imagick::NOISE_GAUSSIAN (int)
    • imagick::NOISE_IMPULSE (int)
    • imagick::NOISE_LAPLACIAN (int)
    • imagick::NOISE_POISSON (int)
    • imagick::NOISE_RANDOM (int)
    • This constant is available if Imagick has been compiled against ImageMagick version 6.3.6 or higher.
  • $channel: The channel constants are provided by this argument. The bitwise operator can be used to combine two or more channels. The following are some of the channel constants available in the Imagick function:
    • imagick::CHANNEL_UNDEFINED (int)
    • imagick::CHANNEL_RED (int)
    • imagick::CHANNEL_GRAY (int)
    • imagick::CHANNEL_CYAN (int)
    • imagick::CHANNEL_GREEN (int)
    • imagick::CHANNEL_MAGENTA (int)
    • imagick::CHANNEL_BLUE (int)
    • imagick::CHANNEL_YELLOW (int)
    • imagick::CHANNEL_ALPHA (int)
    • imagick::CHANNEL_OPACITY (int)
    • imagick::CHANNEL_MATTE (int)
    • imagick::CHANNEL_BLACK (int)
    • imagick::CHANNEL_INDEX (int)
    • imagick::CHANNEL_ALL (int)
    • imagick::CHANNEL_DEFAULT (int)

Return Value

The return type of add noise Image function is of the Boolean type which means the return type of this function will be either a true value or a false value. The return value of this function depends upon the success or failure of the add noise operation. if the addition of noise into the specified image is successful then the return type of this function will be of True Type depicting that the noise is successfully added to our image. on the other hand, if adding noise operation to the image is failed or there is some issue raised due to the wrong parameters specified the return type will be of failure representing an unsuccessful operation of addition of noise to the image.



Imagick addNoiseImage() Function

The example that is written above shows us one of the use case scenarios of the add noise Image function provided by PHP. in this example the at noise Image function is used to create the captcha image this captcha image is made by adding deliberate noise with the help of this function. the captcha images are used broadly across the internet these days to verify the differentiation between the humans and robots accessing various websites throughout the internet.



Imagick addNoiseImage() Function

This is another example that depicts the use case scenario of add noise Image function in PHP. in this example we have added deliberate noise to any image with the help of this function in this function we have to use different methods like method grey-blue and method grey noise with the help of these parameters we can control the type and quantity of the noise that we are introducing to an image.

In this article, we have gone through the use case scenario of add noise Image function provided by PHP and have understood the usage and different parameters that are passed to this function and how we can use this function with different sets of parameters that are available to manipulate the type, quantity, and precision of the noise that we are introducing to the image.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA