Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

PHP | Imagick paintFloodFillImage() Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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:

  • $fill: It holds the ImagickPixel object or a string value to fill the color.
  • $fuzz: It defines the amount of fuzz.
  • $bordercolor: It holds the ImagickPixel object or a string value of the border pixel color.
  • $x: It contains the start position of x-axis of the floodfill.
  • $y: It contains the start position of y-axis of the floodfill.
  • $invert: It contains the Boolean value either TRUE or FALSE. TRUE paints any pixel that does not match the target color.
  • $channel: It contains the channel constants. More than one channel constants can be combined using bitwise operators.

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:
paintFloodFillImage()

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

My Personal Notes arrow_drop_up
Last Updated : 05 Sep, 2019
Like Article
Save Article
Similar Reads
Related Tutorials