php8.5
Home/ Manual/ imagick / imagick/ Imagick::addNoiseImage

Imagick::addNoiseImage

PHP function Edit on GitHub ✎

(PECL imagick 2, PECL imagick 3)

Adds random noise to the image

Description

Imagick::addNoiseImage(int $noise_type, int $channel = Imagick::CHANNEL_DEFAULT): bool

Adds random noise to the image.

Parameters

noise_type

The type of the noise. Refer to this list of noise constants.

channel

Channel

Return Values

Success

Examples

Imagick::addNoiseImage()

php
<?php
function addNoiseImage($noiseType, $imagePath, $channel) {
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->addNoiseImage($noiseType, $channel);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}

?>

Source: reference/imagick/imagick/addnoiseimage.xml · from the official PHP manual (php/doc-en)