Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Imagemagick 如何为System.cmd构建参数?_Imagemagick_Elixir - Fatal编程技术网

Imagemagick 如何为System.cmd构建参数?

Imagemagick 如何为System.cmd构建参数?,imagemagick,elixir,Imagemagick,Elixir,我想使用System.cmd从ImageMagick运行“convert”,但我遇到了困难 System.cmd("convert", ["origin.jpg", "-fill", "black", "-pointsize", "12", "-gravity", "SouthWest", "-draw", "\"text +4,+4 'Test hello world!'\"", "output.jpg"]) args-draw的值是\“text+4,+4'测试hello world!”\”

我想使用System.cmd从ImageMagick运行“convert”,但我遇到了困难

System.cmd("convert", ["origin.jpg", "-fill", "black", "-pointsize", "12", "-gravity", "SouthWest", "-draw", "\"text +4,+4 'Test hello world!'\"", "output.jpg"])
args
-draw
的值是
\“text+4,+4'测试hello world!”\”
,但ImageMagick要求
“text+4,+4'测试hello world!””
不需要转义双引号。
我该怎么做?

您不需要在
System.cmd/3
中使用外部双引号。从shell运行命令时需要它们,因为参数包含空格,如果没有外部双引号,shell将在每个空格上拆分整个内容,并最终传递相当于
[“text”、“+4、+4”、“Test hello world!”]
。以下方面应起作用:

System.cmd(..., [..., "text +4,+4 'Test hello world!'", ...])

试试
[…,“text+4,+4'测试hello world!”,…]
。(没有外引号)哦,是的,你说得对,谢谢!