开发者

How to combine 2 imagemagick commands together

I got 2 seprate Imagemagick commands (resize and crop circle). Is it possible to combine both commands into single PHP exec.

exec('convert original.jpg -resize x100 -gravity center -crop 100x100+0开发者_运维百科+0 +repage thumbnail.jpg');
exec('convert -size 100x100 xc:none -fill thumbnail.jpg -draw "circle 50,50 50,0" circle.png');


start a shell in your exec command and supply the executables as parameters to the shell, separated by ';'

e.g. bash -c "ls /tmp/; echo bla"


I can't test this right now, but have you tried simply literally combining them?

exec('convert original.jpg -resize x100 -gravity center -crop 100x100+0+0 +repage
     xc:none -draw "circle 50,50 50,0" circle.png');

(line break added for clarity)

The only thing I'm unsure about is the xc:none as I don't know what that does. Other than that, it should be easy to combine these.


Maybe you can chain them with the && operand:

exec('convert original.jpg -resize x100 -gravity center -crop 100x100+0+0 +repage thumbnail.jpg && convert -size 100x100 xc:none -fill thumbnail.jpg -draw "circle 50,50 50,0" circle.png');

Even though that's two calls to convert, it's a single PHP exec call.

Regards

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜