Monday, December 8, 2025
HomeLanguagesPHP | Imagick matteFloodfillImage() Function

PHP | Imagick matteFloodfillImage() Function

The Imagick::matteFloodfillImage() function is an inbuilt function in PHP which is used to change the transparency value of a color. This function changes the transparency value of any pixel that matches the target and is an immediate neighbor. 

Syntax:

bool Imagick::matteFloodfillImage(float $alpha, float $fuzz, 
                                   mixed $bordercolor, int $x, int $y)

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

  • $alpha: This parameter holds the level of transparency, 1 is fully opaque and 0 is fully transparent.
  • $alpha: This parameter holds acceptable tolerance to consider two colors as same.
  • $bordercolor: This parameter holds the ImagickPixel object or string representing the border color.
  • $x: This parameter holds the starting x coordinate of the operation.
  • $y: This parameter holds the starting y coordinate of the operation.

Return Value: This function returns TRUE on success. 

Errors/Exceptions: This function throws ImagickException on error. 

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

Program: 

php




<?php
 
// Create a new Imagick object
$imagick = new Imagick(
 
// Applying the matteFloodfillImage() function
$imagick->matteFloodfillImage(0.5, 0, 'red', 0, 0);
 
header("Content-Type: image/jpg");
   
// Display the output image
echo $imagick->getImageBlob();
?>


Output:

  

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32429 POSTS0 COMMENTS
Milvus
103 POSTS0 COMMENTS
Nango Kala
6803 POSTS0 COMMENTS
Nicole Veronica
11945 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12015 POSTS0 COMMENTS
Shaida Kate Naidoo
6934 POSTS0 COMMENTS
Ted Musemwa
7189 POSTS0 COMMENTS
Thapelo Manthata
6883 POSTS0 COMMENTS
Umr Jansen
6870 POSTS0 COMMENTS