Open In App

PHP | Imagick getImageInterpolateMethod() Function

Improve
Improve
Like Article
Like
Save
Share
Report

The Imagick::getImageInterpolateMethod() function is an inbuilt function in PHP which is used to get the interpolation method for the specified image.

Syntax:

int Imagick::getImageInterpolateMethod( void )

Parameters: This function doesn’t accepts any parameter.

Return Value: This function returns an integer value containing the interpolate method which corresponds to one of INTERPOLATE constants.

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)

Exceptions: This function throws ImagickException on error.

Below programs illustrates the Imagick::getImageInterpolateMethod() function in PHP:

Program 1:




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


Output:

0 // which corresponds to imagick::INTERPOLATE_UNDEFINED.

Program 2:




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


Output:

6 // which corresponds to imagick::INTERPOLATE_MESH

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



Last Updated : 22 Nov, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads