Related Articles

Related Articles

PHP | Imagick setImageInterpolateMethod() Function
  • Last Updated : 22 Nov, 2019

The Imagick::setImageInterpolateMethod() function is an inbuilt function in PHP which is used to set the interlace scheme of image.

Syntax:

bool Imagick::setImageInterpolateMethod( int $method )

Parameters: This function accepts a single paramter $method which corresponds to one of INTERPOLATE constants. We can also pass the constant directly like
setImageInterpolateMethod(imagick::INTERPOLATE_BICUBIC);.

List of INTERPOLATE constants are given below:

  • imagick::INTERPOLATE_UNDEFINED (0)
  • imagick::INTERPOLATE_AVERAGE (1)
  • imagick::INTERPOLATE_BICUBIC (2)
  • imagick::INTERPOLATE_BILINEAR (3)
  • imagick::INTERPOLATE_FILTER (4)
  • imagick::INTERPOLATE_INTEGER (5)
  • imagick::INTERPOLATE_MESH (6)
  • imagick::INTERPOLATE_NEARESTNEIGHBOR (7)
  • imagick::INTERPOLATE_SPLINE (8)

Return Value: This function returns TRUE on success.



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

Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Set the Interpolate Method
$imagick->setImageInterpolateMethod(imagick::INTERPOLATE_BILINEAR);
  
// Get the Interpolate Method
$interpolateScheme = $imagick->getImageInterpolateMethod();
echo $interpolateScheme;
?>

chevron_right


Output:

3 // Which corresponds to imagick::INTERPOLATE_BILINEAR.

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Set the Interpolate Method
$imagick->setImageInterpolateMethod(imagick::INTERPOLATE_NEARESTNEIGHBOR);
  
// Get the Interpolate Method
$interpolateScheme = $imagick->getImageInterpolateMethod();
echo $interpolateScheme;
?>

chevron_right


Output:

7 // Which corresponds to imagick::INTERPOLATE_NEARESTNEIGHBOR.

Reference: https://www.php.net/manual/en/imagick.setimageinterpolatemethod.php




My Personal Notes arrow_drop_up
Recommended Articles
Page :