function meanShiftImage(
    $image_path,
    int $width,
    int $height,
    float $color_distance
) {
    $imagick = new \Imagick(realpath($image_path));
    $imagick->meanShiftImage(
        $width,
        $height,
        $color_distance * Imagick::getQuantum()
    );
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}