Found it:

cmd = `convert in.jpg`
for i = 1:xn, j = 1:yn
     color,fillop,x,y,a,b = <stuff that depends on i and j>
     cmd = `$cmd -fill $color -stroke none -draw "fill-opacity $fillop 
ellipse $y,$x $a,$b 0,360" `
end
run(`$cmd out.jpg`)



On Saturday, August 1, 2015 at 4:49:51 PM UTC+10, Yakir Gagnon wrote:
>
> I'm trying to build and run a complicated imagemagick command from within 
> Julia (drawing tons of ellipses in various colors, sizes, etc). To 
> accomplish this I need to basically build a command out of many smaller 
> parts that are parsed in a for-loop. It looks a bit like this right now: 
>
> parseMagick(x,y,l,w) = `-fill $(l.h ? "magenta" : "yellow") -stroke none 
> -draw "fill-opacity $(l.p) ellipse $x,$y $(w*l.p*l.e),$(w*l.p) 0,360" `
>
> cmds = Array(Cmd,xn,yn)
> for i = 1:xn, j = 1:yn
>      cmds[i,j] = parseMagick(xs[i],ys[j],el[i,j],w)
> end
> run(`convert in.jpg $cmds out.jpg`)
>
>
> This doesn't work because of how the cmds array is interpolated into the 
> command. 
> I suspect that I need to use some metaprogramming, which I still find hard 
> to grasp. Anyone knows a good way of doing this?
>
> Thanks!
>

Reply via email to