The Imagick::resampleImage() function is an inbuilt function in PHP which is used to resample the image to the desired resolution
Syntax:
Below program illustrate Imagick::resampleImage() function in PHP:
Program:
php
Output:
Reference: https://www.php.net/manual/en/imagick.resampleimage.php
bool Imagick::resampleImage( $x_resolution, $y_resolution, $filter, $blur )Parameters: This function accepts four parameters as mentioned above and described below:
- $x_resolution: This parameter stores the value of x resolution.
- $y_resolution: This parameter stores the value of y resolution.
- $filter: This parameter stores the value of the filter.
- $blur: This parameter stores the value of the blur level.
Below program illustrate Imagick::resampleImage() function in PHP:
Program:
<?php
// Create new Imagick object
$imagick = new \Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-19.png');
// Use resampleImage function to resize image
$imagick->resampleImage(200, 200, \Imagick::FILTER_LANCZOS, 1);
// Image Header
header("Content-Type: image/jpg");
// Display the output image
echo $imagick->getImageBlob();
?>
Reference: https://www.php.net/manual/en/imagick.resampleimage.php