Open In App

PHP | Imagick liquidRescaleImage() Function

Last Updated : 29 Nov, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The Imagick::liquidRescaleImage() function is an inbuilt function in PHP which is used to animate an image or images. This function mainly rescaling the images. This function scales the images using liquid rescaling method, which is an implementation of a technique called seam carving.
Syntax: 

bool Imagick::liquidRescaleImage( $width, $height, $delta_x, $rigidity )

Parameters: This function accepts four parameters as mentioned above and described below:  

  • $width: This parameter holds the width of the target image.
  • $height: This parameter holds the height of the target image.
  • $delta_x: It defines how much seams traverse on x-axis. The value 0 represents the straight seams.
  • $rigidity: It is used for bias non-straight seams. This parameter is typically 0.

Return Value: This function returns True on success or False on failure.
Below program illustrates the Imagick::liquidRescaleImage() function in PHP:
Program:  

php




<?php
 
// Declare an Imagick object
$imagick = new \Imagick(
 
// Use Imagick::liquidRescaleImage() function
$imagick->liquidRescaleImage( 500, 200, 3, 25 );
     
header( 'Content-Type: image/jpg' );
 
// Display the output
echo $imagick->getImageBlob();
     
?>


Output: 
 

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads