Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

PHP | Imagick setInterlaceScheme() Function

  • Last Updated : 11 Dec, 2019

The Imagick::setInterlaceScheme() function is an inbuilt function in PHP which is used to set the interlace scheme which is later used in the image compression. There are different interlacing schemes available as given below which can be used to achieve the compression.


bool Imagick::setInterlaceScheme( int $interlace_scheme )

Parameters: This function accepts a single parameter $interlace_scheme which holds the integer value corresponding to one of INTERLACE constants.

List of all INTERLACE constants are given below:

  • imagick::INTERLACE_UNDEFINED (0)
  • imagick::INTERLACE_NO (1)
  • imagick::INTERLACE_LINE (2)
  • imagick::INTERLACE_PLANE (3)
  • imagick::INTERLACE_PARTITION (4)
  • imagick::INTERLACE_GIF (5)
  • imagick::INTERLACE_JPEG (6)
  • imagick::INTERLACE_PNG (7)

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.

Below programs illustrate the Imagick::setInterlaceScheme() function in PHP:

Program 1:

// Create a new imagick object
$imagick = new Imagick(
// Set the interlace scheme
// Get the interlace scheme
$interlace_scheme = $imagick->getInterlaceScheme();
echo $interlace_scheme;



Program 2:

// Create a new imagick object
$imagick = new Imagick(
// Set the interlace scheme to be used in
// compression to imagick::INTERLACE_LINE
// Set the quality of the compression
// Show the output
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!