2

我有一个图像,我试图将其扭曲为 30 度角。

到目前为止,我正在从一个示例中处理一些任意控制点。

到目前为止我的代码:

$im = new imagick($thefile);

      $points = 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);
      $im->setImageMatte(true);
      $im->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_TRANSPARENT );
      $im->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
      $im->writeImage($thefile);

另外我不想丢失任何图像,所以我需要弄清楚新图像应该是什么大小才能不丢失任何图像。

扭曲 http://sadtoe.com/temp/distort.jpg

感谢您的任何见解

编辑:查看我如何在 Photoshop 中创建示例图像后,我注意到旋转设置为 30,水平倾斜也是如此。因此,如果我能找到一种旋转和倾斜的方法,透视失真可能不是最简单的方法。

4

0 回答 0