HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::remapImage

← reduceNoiseImage   resampleImage →
Replaces colors an image with those defined by replacement. The colors are replaced with the closest possible color. This method is available if Imagick has been compiled against ImageMagick version 6.4.5 or newer.

Example

function remapImage($image_path, $dither_type)
{
    $imagick = new \Imagick(realpath($image_path));
    $palette = new \Imagick(realpath("images/NetscapeWebSafeColours.gif"));
    $imagick->remapImage($palette, $dither_type);
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}