PHP | Gmagick getimageinterlacescheme() Function

The Gmagick::getimageinterlacescheme() function is an inbuilt function in PHP which is used to get the interlace scheme of the image.

Syntax:

int Gmagick::getimageinterlacescheme( void )

Parameters: This function doesn’t accept any parameters.

Return Value: This function returns an integer value corresponding to one of INTERLACE constants as given below:

  • gmagick::INTERLACE_UNDEFINED (0)
  • gmagick::INTERLACE_NO (1)
  • gmagick::INTERLACE_LINE (2)
  • gmagick::INTERLACE_PLANE (3)
  • gmagick::INTERLACE_PARTITION (4)

Exceptions: This function throws GmagickException on error.

Below given programs illustrate the Gmagick::getimageinterlacescheme() function in PHP:

Program 1:




<?php
  
// Create a new Gmagick object
// https://media.w3wiki.net/wp-content/uploads/w3wiki-13.png
$gmagick = new Gmagick('w3wiki.png');
  
// Get the interlace scheme
$interlaceScheme = $gmagick->getimageinterlacescheme();
echo $interlaceScheme
?>


Output:

0 // Which is the default value for any Gmagick object.

Program 2:




<?php
  
// Create a new Gmagick object
// https://media.w3wiki.net/wp-content/uploads/w3wiki-13.png
$gmagick = new Gmagick('w3wiki.png');
  
// Set the interlace scheme
$gmagick->setimageinterlacescheme(gmagick::INTERLACE_LINE);
  
// Get the interlace scheme
$interlaceScheme = $gmagick->getimageinterlacescheme();
echo $interlaceScheme;
?>


Output:

2 // Which corresponds to gmagick::INTERLACE_LINE.

Reference: https://www.php.net/manual/en/gmagick.getimageinterlacescheme.php


Contact Us