D
D
Darlov2016-02-21 21:42:39
go
Darlov, 2016-02-21 21:42:39

Can't send exec command line to Go correctly, what's wrong?

I'm trying to send commands from go to imagemagic, apparently very little experience, it doesn't work.
Tell me what's wrong?
This is what the command looks like in the imagemagic manual, it works.

composite  -compose Dst_Over -tile pattern:checkerboard  C:\go_project\src\parsing\2.png C:\go_project\src\parsing\test1.png

This is how I send to Go
app1 :="composite"
  args1:="-compose Dst_Over"
  args2:="-tile pattern:checkerboard"
  args3:="C:\\go_project\\src\\parsing\\2.png"
  args4:="C:\\go_project\\src\\parsing\\test1.png"
  cmd1 := exec.Command(app1,args1,args2,args3,args4)
  stdout, err := cmd1.Output()
  if err != nil {
    println(err.Error())
  }

The test1.png file should be created, but it is not there, if I send it directly via the command line, then everything is ok.
It turns out I'm not collecting this line correctly, tell me what could be the error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pavlyuk, 2016-02-21
@ldar

You need it like this:

exec.Command(
    "composite",
    "-compose","Dst_Over",
    "-tile","pattern:checkerboard",
    `C:\go_project\src\parsing\2.png`,
    `C:\go_project\src\parsing\test1.png`,
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question