[Linux/bash] giving -sparse-color arguments as a string ?!
Posted: 2013-05-01T08:20:39-07:00
Hello,
I'm using bash on Linux to do some stuff on my pictures and I've got a small issue with convert and the -sparse-color option.
When calling -sparse-color like this, it works like a charm :
But if I put all the values needed by the -sparse-color option in a string, like that :
It doesn't work anymore :
And I really need to put all the arguments chain in a single string because they are depending on some other variables and their number may vary.
Any help or advices would be really appreciated !
Thanks a lot.
I'm using bash on Linux to do some stuff on my pictures and I've got a small issue with convert and the -sparse-color option.
When calling -sparse-color like this, it works like a charm :
Code: Select all
$ convert -size 900x900 xc: -sparse-color Shepards \
'150,150 rgb(0,255,255) 150,450 rgb(1,5,5) 150,750 rgb(252,1,251) 450,150 rgb(238,255,254)' \
sparse_color.jpg
Code: Select all
$ string="'150,150 rgb(0,255,255) 150,450 rgb(1,5,5) 150,750 rgb(252,1,251) 450,150 rgb(238,255,254)'"
$ echo ${string}
'150,150 rgb(0,255,255) 150,450 rgb(1,5,5) 150,750 rgb(252,1,251) 450,150 rgb(238,255,254)'
Code: Select all
$ convert -size 900x900 xc: -sparse-color Shepards \
"${string}" \
sparse_color.jpg
convert: invalid argument for option `sparse-color': Invalid number of Arguments @ error/mogrify.c/SparseColorOption/443.
Any help or advices would be really appreciated !
Thanks a lot.