On Wed, Jun 01, 2005 at 08:47:20AM -0700, Carl Lowenstein wrote:
> On 5/31/05, John H. Robinson, IV <[EMAIL PROTECTED]> wrote:
> > John H. Robinson, IV wrote:
> > > m ike wrote:
> > > > this
> > > >
> > > >   convert  -draw "line 10,10,20,20"  text.jpg out.jpg
> > > >
> > > > draws a line on the image from 10,10 to 20,20
> > > >
> > > > so does this:
> > > >
> > > >   g="line 10,10,20,20"
> > > >   convert -draw "$g"  text.jpg out.jpg
> > > >
> > > > but this chokes:
> > > >
> > > >   g='-draw "line 10,10,20,20"'
> > > >   echo $g
> > > >   convert $g text.jpg out.jpg
> > > >
> > > > appearantly convert is seeing "line 10,10,20,20" as two
> > > > arguments, divided at the space.
> > > >
> > > > I'm at a loss. any ideas?
> > >
> > > Use a better shell:
> > >
> > > in zsh:
> > >
> > > % g=(-draw "line 10,10,20,20"); convert -fill black $g mushroom.jpg X:-
> > >
> > > That makes a pretty diagonal line, just as you expect.
> > 
> > However, if you *insist* upon using bash:
> > 
> > $ typeset -a g
> > $ g=(-draw "line 10,10,20,20")
> > $ convert -fill black "[EMAIL PROTECTED]" mushroom.jpg X:-
> > 
> > Note the arcane syntax for the expansion of the environmental variable
> > g. You must use the quotes, otherwise it does not work as desired.
> > 
> > > -john
> 
> Maybe what you need to do is step back from the problem and write your
> own "little language" interpreter that does nothing but take in
> line-drawing specifications and turn them into properly formatted
> input for "convert".  That way you don't have to fit the input
> language to a pre-existing interpreter (shell).
> 
> See various books by Brian Kernighan with discussion of "little languages".
> 
>     carl

If you're going to do that, skip writing your own language and tie the C
routines for line drawing into a Tcl/Tk shell. Or they may already be
available as a package.

http://www.tcl.tk/

-- 
Lan Barnes                    [EMAIL PROTECTED]
Linux Guy, SCM Specialist     858-354-0616


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to