<?php
/* Create new object */
$im = new Imagick( 'test.jpg' );
/* Scale down */
$im->liquidRescaleImage( 500, 200, 3, 25 );
/* Display */
header( 'Content-Type: image/jpg' );
echo $im;
?>
(PECL imagick 2 >= 2.2.0, PECL imagick 3)
Imagick::liquidRescaleImage — Animates an image or images
This method scales the images using liquid rescaling method. This method is an implementation of a technique called seam carving. In order for this method to work as expected ImageMagick must be compiled with liblqr support. 此方法在Imagick基于ImageMagick 6.3.9以上版本编译时可用。
width
The width of the target size
height
The height of the target size
delta_x
How much the seam can traverse on x-axis. Passing 0 causes the seams to be straight.
rigidity
Introduces a bias for non-straight seams. This parameter is typically 0.
成功时返回 true
。
<?php
/* Create new object */
$im = new Imagick( 'test.jpg' );
/* Scale down */
$im->liquidRescaleImage( 500, 200, 3, 25 );
/* Display */
header( 'Content-Type: image/jpg' );
echo $im;
?>