PHP | Imagick setImageInterpolateMethod() Function
Last Updated :
12 Jan, 2022
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 parameter $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:
PHP
<?php
$imagick = new Imagick(
$imagick ->setImageInterpolateMethod(imagick::INTERPOLATE_BILINEAR);
$interpolateScheme = $imagick ->getImageInterpolateMethod();
echo $interpolateScheme ;
?>
|
Output:
3 // Which corresponds to imagick::INTERPOLATE_BILINEAR.
Program 2:
PHP
<?php
$imagick = new Imagick(
$imagick ->setImageInterpolateMethod(imagick::INTERPOLATE_NEARESTNEIGHBOR);
$interpolateScheme = $imagick ->getImageInterpolateMethod();
echo $interpolateScheme ;
?>
|
Output:
7 // Which corresponds to imagick::INTERPOLATE_NEARESTNEIGHBOR.
Reference: https://www.php.net/manual/en/imagick.setimageinterpolatemethod.php
Share your thoughts in the comments
Please Login to comment...