如何将此ImageMagick命令转换为PHP Imagick等效命令?

时间:2012-07-14 13:51:48

标签: php imagemagick imagick

我正在尝试在ImageMagick文档中关注this“教程”,但遇到了很多麻烦。我想在其Imagick PHP equivelant中完成以下ImageMagic命令:

convert -virtual-pixel transparent \
                        \( $top -matte  +distort Affine \
                            '0.5,511.5 0.5,0.5   0.5,0.5 -87.5,-50  511.5,511.5 87.5,-50' \) \
                        \( $left -matte +distort Affine \
                            '511.5,0.5 0.5,0.5   0.5,0.5 -87.5,-50  511.5,511.5 0.5,99.5' \) \
                        \( $front -matte  +distort Affine \
                            '0.5,0.5 0.5,0.5   0.5,319.5 0.5,99.5   319.5,0.5 87.5,-50.0' \) \
                        -background black -layers merge +repage \
                        -bordercolor black -border 5x2     isometric_cube_overlap.png

$top = new Imagick('top.png'); $front = new Imagick('front.png'); $left = new Imagick('left.png');。每个都是512x512px png图像。

我在仿射变换上找到了一些rather lacking documentation,但我不知道$matrix应该是什么或者如何使用该函数。我甚至尝试在实际的ImageMagick命令上运行exec,但什么都没发生。我希望转换已经完成并保存为isometric_cube_overlap.png

我真的可以在这里使用一些帮助,即使有人可以指出我正确的方向。谢谢!

1 个答案:

答案 0 :(得分:0)

当然你可以这样运行命令吗?

<?php 
    $cmd = " convert -virtual-pixel transparent \
                    \( $top -matte  +distort Affine \
                        '0.5,511.5 0.5,0.5   0.5,0.5 -87.5,-50  511.5,511.5 87.5,-50' \) \
                    \( $left -matte +distort Affine \
                        '511.5,0.5 0.5,0.5   0.5,0.5 -87.5,-50  511.5,511.5 0.5,99.5' \) \
                    \( $front -matte  +distort Affine \
                        '0.5,0.5 0.5,0.5   0.5,319.5 0.5,99.5   319.5,0.5 87.5,-50.0' \) \
                    -background black -layers merge +repage \
                    -bordercolor black -border 5x2     isometric_cube_overlap.png "." -distort ScaleRotateTranslate \"28,24  .4,.8  -110  50,120 \" ";
    exec("$cmd");
?> 

反斜杠对我来说也不合适。 我打赌那个命令的输出也失败了?