JavaScript Editor Javascript debugger     Website design 


Distorts an image using various distortion methods ()
bool Imagick::distortImage ( int method, array arguments, bool bestfit )


This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.

Distorts an image using various distortion methods, by mapping color lookups of the source image to a new destination image usally of the same size as the source image, unless 'bestfit' is set to true. If 'bestfit' is enabled, and distortion allows it, the destination image is adjusted to ensure the whole source 'image' will just fit within the final destination image, which will be sized and offset accordingly. Also in many cases the virtual offset of the source image will be taken into account in the mapping. This functionality is present if Imagick is compiled against ImageMagick 6.3.6 or later.



The method of image distortion. See distortion constants


The arguments for this distortion method


Attempt to resize destination to fit distorted source

Return Values

Returns TRUE on success.


Throws ImagickException on error.


Example 1040. Using Imagick::distortImage():

Distort an image and write it to the disk.


= new imagick( "example.jpg" );

$im->distortImage( Imagick::DISTORTION_PERSPECTIVE, array( 7,40, 4,30, 4,124, 4,123, 85,122, 100,123, 85,2, 100,30 ), true );

$im->writeImage( "example_out.jpg" );