How to translate this ImageMagick command into its equivalent PHP Imagick?

I am trying to follow this โ€œtutorialโ€ in the ImageMagick documentation, but you have a lot of problems. I want to execute the following ImageMagic command in my Imagick PHP equivelant:

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 

Where $top = new Imagick('top.png'); , $front = new Imagick('front.png'); and $left = new Imagick('left.png'); . Each of them is a 512x512px png image.

I found a bit more likely the missing documentation in the affine transformation, but I don't know what the $matrix should be or how to use the function. I even tried running exec on a valid ImageMagick command, but nothing happened. I expected the conversion to be completed and saved as isometric_cube_overlap.png .

I could really use some help here, even if someone could just point me in the right direction. Thanks!

+4
source share
1 answer

Of course, can you just run the command as such?

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

Also, the backslash doesn't suit me. Are you sure the output of this command also does not work?

0
source

All Articles