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(); }