Page 1 of 1

Why are spaces forbidden in the -convolve argument

Posted: 2018-06-21T04:38:15-07:00
by Jean-Pierre Coulon
magick -convolve 1,1,1,1,1,1,1,1,1 works well but fails if I say 1,1,1, 1,1,1, 1,1,1. This would help me to arrange my array when it is bigger e.g. 7x7.

Any workaround?

Re: Why are spaces forbidden in the -convolve argument

Posted: 2018-06-21T09:02:56-07:00
by fmw42
Put quotes about your arguments and see if that works. With spaces, the arguments are considered as multiple sets of arguments and not one set.

Also consider using the newer -morphology convolve rather than the older legacy -convolve. See http://www.imagemagick.org/Usage/convolve/

Re: Why are spaces forbidden in the -convolve argument

Posted: 2018-06-21T09:26:39-07:00
by snibgo
The shell (bash, or Windows CMD, or whatever) breaks the command line at spaces into arguments, passing each of those separately to the executable binary. But it treats a quoted string as a single arguments, even if it contains spaces.

For Windows, use double-quote: ".

For bash, use single-quote ' or double-quote ", according to your needs.

Re: Why are spaces forbidden in the -convolve argument

Posted: 2018-06-22T00:22:01-07:00
by Jean-Pierre Coulon
With Windows I obtain what I want with
magick chunk.png -convolve ^
0,0,3,4,3,0,0,^
3,4,4,4,4,4,3,^ etc.

Re: Why are spaces forbidden in the -convolve argument

Posted: 2018-06-22T08:58:52-07:00
by fmw42
Jean-Pierre Coulon wrote:
2018-06-22T00:22:01-07:00
With Windows I obtain what I want with
magick chunk.png -convolve ^
0,0,3,4,3,0,0,^
3,4,4,4,4,4,3,^ etc.
You have no spaces so it works fine. The issue was when the argument to -convolve has spaces, which require quoting.