PHP | Imagick setImageFormat() Function
Last Updated :
25 Feb, 2022
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 format like png, svg, etc. Format support is totally depends on the installation of the imagick.
Return Value: This function returns TRUE on success.
Below programs illustrate the Imagick::setImageFormat() function in PHP:
Program 1:
php
<?php
$imagick = new Imagick(
$imagick ->setImageFormat( 'png' );
$format = $imagick ->getImageFormat();
echo $format ;
?>
|
Output:
png
Program 2:
php
<?php
$imagick = new Imagick(
$imagick ->setImageFormat( 'jpeg' );
$format = $imagick ->getImageFormat();
echo $format ;
?>
|
Output:
jpeg
Reference: https://www.php.net/manual/en/imagick.setimageformat.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...