Imagick::displayImages
Imagick::drawImage
The Imagick class
PHP Manual

# Imagick::distortImage

(PECL imagick 2.0.1)

Imagick::distortImage — Distorts an image using various distortion methods

### 설명

bool Imagick::distortImage ( int `$method` , array `$arguments` , bool `$bestfit` )

Distorts an image using various distortion methods, by mapping color lookups of the source image to a new destination image usually 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.

### 인수

`method`

  The method of image distortion. See distortion constants

`arguments`

  The arguments for this distortion method

`bestfit`

  Attempt to resize destination to fit distorted source

### 반환값

성공시에 `TRUE`를 반환합니다.

### 오류/예외

오류시에 ImagickException이 발생합니다.

### 예제

Example #1 Using Imagick::distortImage():

Distort an image and write it to the disk.

`<?php
/* Create new object */
$im = new Imagick();
/* Create new checkerboard pattern */
$im->newPseudoImage(100, 100, "pattern:checkerboard");
/* Set the image format to png */
$im->setImageFormat('png');
/* Fill new visible areas with transparent */
$im->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
/* Activate matte */
$im->setImageMatte(true);
/* Control points for the distortion */
$controlPoints = array( 10, 10,
10, 5,
10, $im->getImageHeight() - 20,
10, $im->getImageHeight() - 5,
$im->getImageWidth() - 10, 10,
$im->getImageWidth() - 10, 20,
$im->getImageWidth() - 10, $im->getImageHeight() - 10,
$im->getImageWidth() - 10, $im->getImageHeight() - 30);
/* Perform the distortion */
$im->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true);
/* Ouput the image */
header("Content-Type: image/png");
echo $im;
?>`

### 참고

- Imagick::blurImage() - Adds blur filter to image
- Imagick::motionBlurImage() - Simulates motion blur
- Imagick::radialBlurImage() - Radial blurs an image

Imagick::displayImages
Imagick::drawImage
The Imagick class
PHP Manual