Replaces colors in the image from a color lookup table. Optional second parameter to replace colors in a specific channel. Available since 6.3.6
Applies a Colour LookUp Table to an image. The CLUT should be an image 1 pixel wide.

The colours will be 'looked up' in the clut by using the intensity of each pixel in source image e.g. black will be taken from one end of the CLUT, white the other end, and all other values interpolated from there relevant position in the CLUT, according to the set interpolation method.

Using \Imagick::INTERPOLATE_BILINEAR means that a very small clut can be used to generate a smooth palette of colours.
Replaces colors in the image from a color lookup table. Optional second parameter to replace colors in a specific channel. Available since 6.3.6
Applies a Colour LookUp Table to an image. The CLUT should be an image 1 pixel wide.

The colours will be 'looked up' in the clut by using the intensity of each pixel in source image e.g. black will be taken from one end of the CLUT, white the other end, and all other values interpolated from there relevant position in the CLUT, according to the set interpolation method.

Using \Imagick::INTERPOLATE_BILINEAR means that a very small clut can be used to generate a smooth palette of colours.
Parameters
lookup_tableImagickImagick object containing the color lookup table
channelfloatThe Channeltype constant. When not supplied, default channels are replaced.
        // Make a shape
        $draw = new \ImagickDraw();
        $draw->setStrokeOpacity(0);
        $draw->setFillColor('black');
        $points = [
            ['x' => 40 * 3, 'y' => 10 * 5],
            ['x' => 20 * 3, 'y' => 20 * 5],
            ['x' => 70 * 3, 'y' => 50 * 5],
            ['x' => 80 * 3, 'y' => 15 * 5],
        ];
        $draw->polygon($points);
        $imagick = new \Imagick();
        $imagick->newPseudoImage(
            300, 300,
            "xc:white"
        );

        $imagick->drawImage($draw);
        $imagick->blurImage(0, 10);

        //Make a gradient
        $draw = new \ImagickDraw();
        $draw->setStrokeOpacity(0);
        $draw->setFillColor('red');
        $draw->point(0, 2);
        $draw->setFillColor('yellow');
        $draw->rectangle(0, 0, 1, 1);
        $gradient = new Imagick();
        $gradient->newPseudoImage(1, 5, 'xc:none');
        $gradient->drawImage($draw);
        $gradient->setImageFormat('png');

        //These two are needed for the clutImage to work reliably.
        $imagick->setImageAlphaChannel(\Imagick::ALPHACHANNEL_DEACTIVATE);
        $imagick->transformImageColorspace(\Imagick::COLORSPACE_GRAY);
        // $imagick->setImageInterpolateMethod(\Imagick::INTERPOLATE_INTEGER);

        //Make the color lookup be smooth
        $gradient->setImageInterpolateMethod(\Imagick::INTERPOLATE_BILINEAR);
        //Nearest neighbour uses exact color values from clut
        //$gradient->setImageInterpolateMethod(\Imagick::INTERPOLATE_NEARESTNEIGHBOR);

        $imagick->clutImage(
            $gradient,
            \Imagick::CHANNEL_RGBA
        );

        $imagick->setImageFormat('png');

        header("Content-Type: image/png");
        echo $imagick->getImageBlob();