PHP | Imagick setImageOpacity() Function Last Updated : 10 Jan, 2022 Comments Improve Suggest changes Like Article Like Report The Imagick::setImageOpacity() function is an inbuilt function in PHP which is used to set the opacity level of an Imagick object. This method is available in ImageMagick 6.3.1 or newer versions. Syntax: bool Imagick::setImageOpacity( $opct ) Parameters: This function accepts single parameter $opct which specifies the opacity of Imagick object to be set. Return Value: This function returns True on success. Below programs illustrate the Imagick::setImageOpacity() function in PHP: Original Image: Program 1: php <?php // Create new Imagick object $im = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Using setImageOpacity function $im->setImageOpacity(0.3); // Display result header("Content-Type: image/jpg"); echo $im->getImageBlob(); ?> Output: Original Image: Program 2: php <?php $string = "Computer Science portal for Geeks!"; // Creating new image of above String // and add color $im = new Imagick(); $draw = new ImagickDraw(); // Fill the color in image $draw->setFillColor(new ImagickPixel('green')); // Set the text font size $draw->setFontSize(50); $matrix = $im->queryFontMetrics($draw, $string); $draw->annotation(0, 40, $string); $im->newImage($matrix['textWidth'], $matrix['textHeight'], new ImagickPixel('white')); // Draw the image $im->drawImage($draw); $im->setImageFormat('jpeg'); // Using setImageOpacity function $im->setImageOpacity(0.9); header("Content-Type: image/jpg"); echo $im->getImageBlob(); ?> Output: Reference: http://php.net/manual/en/imagick.setimageopacity.php Comment More infoAdvertise with us Next Article PHP | Imagick setImageOpacity() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Imagick +1 More Similar Reads PHP | Imagick setImageProperty() Function The Imagick::setImageProperty() function is an inbuilt function in PHP which is used to set the image property. The main difference between image properties and image artifacts is that the properties are public whereas artifacts are private. Syntax: bool Imagick::setImageProperty( string $name, stri 1 min read PHP | Imagick setImageFormat() Function The Imagick::setImageFormat() function is an inbuilt function in PHP which is used to set the format of a particular image in a sequence.Syntax:  bool Imagick::setImageFormat( string $format ) Parameters: This function accepts a single parameter $format which holds a string value of the image forma 1 min read PHP | Imagick setImagePage() Function The Imagick::setImagePage() function is an inbuilt function in PHP which is used to set the image page geometry. Syntax: bool Imagick::setImagePage(int $width, int $height, int $x, int $y ) Parameters: This function accepts four parameters as mentioned above and described below: $width: It specifies 1 min read PHP | Imagick setImageType() Function The Imagick::setImageType() function is an inbuilt function in PHP which is used to set the image type.Syntax:  bool Imagick::setImageType( int $image_type ) Parameters: This function accepts a single parameter $image_type which contains an integer value corresponding to one of IMGTYPE constants. W 1 min read PHP | Imagick setImageUnits() Function The Imagick::setImageUnits() function is an inbuilt function in PHP which is used to set the units of resolution of a particular image.Syntax:  bool Imagick::setImageUnits( $units ) Parameters: This function accepts single parameter $units which is used to specify the units to be set for image. Res 2 min read Like