NOISE_UNIFORM = 1;
NOISE_GAUSSIAN = 2;
NOISE_MULTIPLICATIVEGAUSSIAN = 3;
NOISE_IMPULSE = 4;
NOISE_LAPLACIAN = 5;
NOISE_POISSON = 6;
NOISE_RANDOM = 7;

NOISE_UNIFORM = 1;
NOISE_GAUSSIAN = 2;
NOISE_MULTIPLICATIVEGAUSSIAN = 3;
NOISE_IMPULSE = 4;
NOISE_LAPLACIAN = 5;
NOISE_POISSON = 6;
NOISE_RANDOM = 7;
function addNoiseImageWithAttenuate($noiseType, $attenuate, $image_path, $channel)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->addNoiseImageWithAttenuate($noiseType, $attenuate, $channel);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}