PHP | Imagick mapImage() Function Last Updated : 05 Sep, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Imagick::mapImage() function is an inbuilt function in PHP which is used to replace the colors of an image with the closest color from a reference image. Syntax: bool Imagick::mapImage( Imagick $map, float $dither ) Parameters: This function accepts two parameters as mentioned above and described below: $map: This parameter holds the Imagick object. $dither: This parameter holds a boolean which decides whether to add noise or not. Return Value: This function returns TRUE on success. Errors/Exceptions: This function throws ImagickException on error. Below programs illustrate the Imagick::mapImage() function in PHP: Program 1: php <?php // Create a new imagick object $imagick1 = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190823154611/geeksforgeeks24.png'); // Create another imagick object $imagick2 = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190901195451/mattefloodfillimage.png'); // Mapping the image with noise $imagick1->mapImage($imagick2, true); header("Content-Type: image/jpg"); // Display the output image echo $imagick1->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick1 = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190823154611/geeksforgeeks24.png'); // Create another imagick object $imagick2 = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190901195451/mattefloodfillimage.png'); // Mapping the image without noise $imagick1->mapImage($imagick2, false); header("Content-Type: image/jpg"); // Display the output image echo $imagick1->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagick.mapimage.php Comment More infoAdvertise with us Next Article PHP | Imagick mosaicImages() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Imagick newImage() Function The Imagick::newImage() function is an inbuilt function in PHP which is used to creates a new image. This function creates a new image and associates ImagickPixel value as the background color. Syntax:Â bool Imagick::newImage( $cols, $rows, $background, $format ) Parameters: This function accepts fo 1 min read PHP | Imagick mosaicImages() Function The Imagick::mosaicImages() function is an inbuilt function in PHP which is used to form a mosaic from images. This function uses an image sequence to form a single coherent picture. Syntax: Imagick Imagick::mosaicImages( void ) Parameters: This function does not accepts any parameters. Return Value 1 min read PHP | Imagick labelImage() Function The Imagick::labelImage() function is an inbuilt function in PHP which is used to add label to an image. Syntax: bool Imagick::labelImage( string $label ) Parameters: This function accepts a single parameter $label which holds the label to add to the image. Return Value: This function returns TRUE o 1 min read PHP | Imagick montageImage() Function The Imagick::montageImage() function is an inbuilt function in PHP which is used to create a composite image by combining the many separated images. This function composite the images into the tiles form with the name of image optionally. Syntax: Imagick Imagick::montageImage( ImagickDraw $draw, str 2 min read PHP | Imagick modulateImage() Function The Imagick::modulateImage() function is an inbuilt function in PHP which is used to control the brightness, saturation, and hue of an image. Syntax: bool Imagick::modulateImage( $brightness, $saturation, $hue ) Parameters: This function accepts three parameters as mentioned above and described belo 1 min read PHP | Imagick nextImage() Function The Imagick::nextImage() function is an inbuilt function in PHP which is used to move to the next image within the Imagick instance. An Imagick instance may consist of a list of images within it and Imagick nextImage() associates the next image in the image list with an Imagick instance.Syntax:bool 1 min read Like