1
我要設置圖像的角度。我有空白多邊形筆記本電腦的圖像imagick :: distortimage
需要在空白區域拉另一個圖像。就像這樣:
所以,我對動態失真驗證碼:
$controlPoints = array(0, 0,
0, 0,
0, $im->getImageHeight(),
0, $im->getImageHeight(),
$im->getImageWidth(), 0,
$im->getImageWidth(), 0,
$im->getImageWidth(), $im->getImageHeight(),
$im->getImageWidth(), $im->getImageHeight());
/* Perform the distortion */
$im->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true);
如何設置$控制點陣列?我不能只設置4個座標到圖像的每個角落?不幸的是,imageick :: distort圖像的文檔很差。
問題是通過使用另一種方法失真解決:
$im->cropImage(125, 121, $center_x, $center_y);
$controlPoints = array(
0,0, 35,20, # top left
190,0, 150,30, # top right
0,205, -16,105, # bottom right
176,135, 115,105 # bottum left
);
/* Perform the distortion */
$im->distortImage(Imagick::DISTORTION_BILINEAR, $controlPoints, true);