PHP | Gmagick setimageformat() Function Last Updated : 17 Jul, 2020 Comments Improve Suggest changes Like Article Like Report The Gmagick::setimageformat() function is an inbuilt function in PHP which is used to set the image format. Syntax: Gmagick Gmagick::setimageformat( string $imageFormat ) Parameters: This function accepts a single parameter $imageFormat which holds the image format. Return Value: This function returns Gmagick object on success. Exceptions: This function throws GmagickException on error. Below given programs illustrate the Gmagick::setimageformat() function in PHP: Used Image: Program 1: php <?php // Create a new Gmagick object $gmagick = new Gmagick('geeksforgeeks.png'); // Set the format $gmagick->setimageformat('jpeg'); // Get the format $format = $gmagick->getimageformat(); echo $format; ?> Output: jpeg Program 2: php <?php // Create a new Gmagick object $gmagick = new Gmagick('geeksforgeeks.png'); // Set the format $gmagick->setimageformat('jpeg'); // Get the format $gmagick->write('mynewimage.' . $gmagick->getimageformat()); echo 'Image saved in same folder successfully'; ?> Output: This will change the format to jpeg from png and save image in same folder. Reference: https://www.php.net/manual/en/gmagick.setimageformat.php Comment More infoAdvertise with us Next Article PHP | Gmagick setimageformat() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads 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 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 | Gmagick setimagetype() Function The Gmagick::setimagetype() function is an inbuilt function in PHP which is used to set the image type. Syntax: Gmagick Gmagick::setimagetype( int $imgType ) Parameters: This function accepts a single parameter $imgType which holds an integer value corresponding to one of the IMGTYPE constants. All 2 min read PHP | Gmagick setimageunits() Function The Gmagick::setimageunits() function is an inbuilt function in PHP which is used to set the units of resolution of a particular image. This function has no visual impact on the image but just changes the units of resolution which can be one of Undefinedresolution, PixelsPerInchResolution, or Pixels 1 min read PHP | Gmagick setimagedepth() function The Gmagick::setimagedepth() function is an inbuilt function in PHP which is used to set the depth of a particular image. Syntax: Gmagick Gmagick::setimagedepth( $depth ) Parameters: This function accepts a single parameter $depth which is an integer value and used to set the depth of image. Return 2 min read Like