Thursday, July 4, 2024
HomeLanguagesPhpPHP | Imagick paintFloodFillImage() Function

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:

  • $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

Nicole Veronica Rubhabha
Nicole Veronica Rubhabha
A highly competent and organized individual DotNet developer with a track record of architecting and developing web client-server applications. Recognized as a personable, dedicated performer who demonstrates innovation, communication, and teamwork to ensure quality and timely project completion. Expertise in C#, ASP.Net, MVC, LINQ, EF 6, Web Services, SQL Server, MySql, Web development,
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments