在php Imagick中更改弧线方向

问题描述

我正在PHP中使用Imagick来处理和使用CompositeImage重叠图像,然后弯曲图像的顶部和底部边界。为此,我使用了disTORTION_ARC

$distortPoints = array( 120 );
$img->setimageVirtualPixelMethod( Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
$img->setimageMatte( TRUE );
$img->distortimage(Imagick::disTORTION_ARC,$distortPoints,FALSE);

这使图像呈弧形,但我希望反转弧(https://photos.app.goo.gl/1JAthzLBoVsozQy97)的方向。

更新:

我在Fred的ImageMagick脚本(http://www.fmwconcepts.com/imagemagick/cylinderwarp/index.php)中找到了一个脚本,该脚本确实可以满足我的需求,但是我无法在PHP中使用它。

解决方法

我不确定我了解您在ImageMagick中真正想要的效果。但是这里有两个例子。第一对使用-distort圆弧,第二对使用-distort圆桶。在每对图像中,一个图像弯曲一种方式,另一幅图像弯曲另一种方式。

第二个命令回答了您有关向下弯曲弧形的问题。


enter image description here

convert rose: -virtual-pixel White -distort arc 60 rose1.jpg

enter image description here

convert rose: -virtual-pixel White -rotate 180 -distort arc 60 -rotate 180 rose2.jpg

enter image description here

convert rose: -virtual-pixel White -distort barrel "0.0 0.0 0.0 1.0   0.0 0.0 0.5 0.5"  rose3.jpg

enter image description here

convert rose: -virtual-pixel White -distort barrel "0.0 0.0 0.0 1.0   0.0 0.0 -0.5 1.9" rose4.jpg

enter image description here

,

这里是使用我的ImageMagick圆柱化命令将图像放在杯子上的结果。

图片:

enter image description here

杯子:

enter image description here

cylinderize -m vertical -r 73 -l 120 -w 40 -p 5 -n 94 -e 2 -a 0 -v background -b none -f none -o +24+10 stay_home.jpg coffee_mug1.jpg result.jpg

结果:

enter image description here


请参阅我的主页,了解与PHP exec()一起使用的Pointers。

注意:出于商业目的使用我的脚本,您需要与我联系以获取许可。