Saturday, November 22, 2025
HomeLanguagesPHP | Imagick resampleImage() Function

PHP | Imagick resampleImage() Function

The Imagick::resampleImage() function is an inbuilt function in PHP which is used to resample the image to the desired resolution

Syntax:

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.

Return Value: This function returns True on success.
Original Image:

Below program illustrate Imagick::resampleImage() function in PHP:

Program:




<?php    
       
// Create new Imagick object
$imagick = new \Imagick(
       
// 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();
?>


Output:

Reference: http://php.net/manual/en/imagick.resampleimage.php

RELATED ARTICLES

Most Popular

Dominic
32407 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6784 POSTS0 COMMENTS
Nicole Veronica
11931 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11999 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7168 POSTS0 COMMENTS
Thapelo Manthata
6863 POSTS0 COMMENTS
Umr Jansen
6848 POSTS0 COMMENTS