4

我正在尝试遵循ImageMagick 文档中的这个“教程”,但是遇到了很多麻烦。我想在其 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 图像。

我发现一些关于仿射变换的文档相当缺乏,但我不知道$matrix应该是什么,甚至不知道如何使用该函数。我什至尝试exec在实际的 ImageMagick 命令上运行,但什么也没发生。我期待转换已经完成并保存为isometric_cube_overlap.png.

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

4

1 回答 1

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");
?> 

此外,反斜杠对我来说也不合适。我敢打赌该命令的输出也失败了?

于 2012-07-17T12:28:50.410 回答