PHP | Imagick liquidRescaleImage() Function

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

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



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.