HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

Imagick::swirlImage

← subImageMatch   swirlImageWithMethod →
Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.
// Example 1
function swirlImage($image_path, $swirl)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->swirlImage($swirl);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}
// Example 2 - WithMethod
function swirlImageWithMethod($image_path, $swirl, int $interpolate_method)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->swirlImageWithMethod($swirl, $interpolate_method);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}