PHP | Imagick setOption() Function Last Updated : 28 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The Imagick::setOption() function is an inbuilt function in PHP which is used to set an option. Syntax: bool Imagick::setOption( string $key, string $value ) Parameters: This function accepts two parameters as mentioned above and described below: $key: It specifies the key for the option. $value: It specifies the value associated with the key. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::setOption() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); $imagick->setImageFormat('jpg'); // Set the option $imagick->setOption('jpeg:extent', 90); // Display the image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Set the option $imagick->setOption('key1', 'option1'); // Get the option with key 'key1' $option = $imagick->getOption('key1'); echo $option; ?> Output: option1 Reference: https://www.php.net/manual/en/imagick.setoption.php Comment More infoAdvertise with us Next Article PHP | Imagick setOption() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Imagick setResolution() Function The Imagick::setResolution() function is an inbuilt function in PHP which is used to set the resolution for image. This function doesn't changes the actual resolution of a image but just sets it in the Imagick object before image is read or created, for changing image resolution use setImageResoluti 2 min read PHP | Imagick setFont() Function The Imagick::setFont() function is an inbuilt function in PHP which is used to set the font. Syntax: bool Imagick::setFont( string $font ) Parameters: This function accepts single parameter $font which holds the name of font file. Return Value: This function returns TRUE on success. Extensions: GD e 1 min read PHP | Imagick __toString() Function The Imagick::__toString() function is an inbuilt function in PHP which is used to return the image as a string. This function will only return a single image and should not be used for Imagick objects containing multiple images. Syntax: string Imagick::__toString( void ) Parameters:This function doe 1 min read PHP | Imagick setFormat() Function The Imagick::setFormat() function is an inbuilt function in PHP which is used to set the format of the Imagick object. Syntax: bool Imagick::setFormat( string $format ) Parameters: This function accepts a single parameter $format which holds an string value. Return Value: This function returns TRUE 1 min read PHP | Imagick setPage() Function The Imagick::setPage() function is an inbuilt function in PHP which is used to set the page geometry of the Imagick object. Syntax: bool Imagick::setPage( int $width, int $height, int $x, int $y ) Parameters:This function accepts four parameters as mentioned above and described below: $width: It spe 2 min read Like