Open In App

PHP | Imagick paintFloodFillImage() Function

The paintFloodFillImage() function is an inbuilt function in PHP which is used to change the color value of any pixel that matches to the target and is an immediate neighbor.

Syntax:



bool Imagick::paintFloodFillImage( $fill, $fuzz, $bordercolor, 
                                   $x, $y, $channel = Imagick::CHANNEL_DEFAULT )

Note: This function is being replaced by Imagick::floodFillPaintImage() function.

Parameters: This function accepts six parameters as mentioned above and described below:



Return Value: This function returns TRUE on success.

Below program illustrates the Imagick::floodFillPaintImage() function in PHP:

Program:




<?php 
  
// Creating an imagick object
$img = new Imagick(
   
// Use Imagick::paintFloodFillImage() function to change the 
// color value of the target color
$img->floodFillPaintImage('cyan', 1, 'white', 1, 1, false); 
   
header("Content-Type: image/png"); 
   
// Display the output image 
echo $img->getImageBlob(); 
?>

Output:

Reference: https://www.php.net/manual/en/imagick.paintfloodfillimage.php

Article Tags :