Page 1 of 1

Image Stack vs. temp files - "-draw" option

Posted: 2008-08-18T19:26:22-07:00
by stevepugh
Hi all,

I have a Windows program which currently generates a batch file with three "convert.exe" commands to generate two temporary image files and composite them onto a third, finally saving the third one out and deleting the temp files.

To streamline things and stick to just one execution of "convert.exe", I love the idea of using an image stack. However, when I replace the name of the temp file with what I believe to be the correct syntax for an image stack, I get the error "convert.exe: option requires an argument '-draw'"

I used to have the following on one line -

Code: Select all

convert -size 700x260 -background transparent -fill White -font Arial -pointsize 40 caption:"hello" tempfile.jpg
and that was followed by another convert, which included "-draw image over 915.640.0.0 tempfile.jpg"

Now I have the following -

Code: Select all

-draw "image over 915,640 0,0 (-size 700x260 -background transparent -fill White -font Arial -pointsize 40 caption:"hello")"
This is where I get the error "convert.exe: option requires an argument '-draw'"
Is this philosophically correct? Am I doomed to a life without the joy and light that is image stacking?

Best,
Steve

Re: Image Stack vs. temp files - "-draw" option

Posted: 2008-08-18T19:47:39-07:00
by fmw42
I am not sure this is your problem, but parentheses need to have a space before and after them. The stuff inside the parens needs to have a white space between it and the parens. In your example that does not appear to be the case.

Not sure of this either, but you may need to escape the double quotes around "hello"

Re: Image Stack vs. temp files - "-draw" option

Posted: 2008-08-18T21:00:41-07:00
by el_supremo
I'm pretty sure you can't do that sort of substitution of an image filename inside a -draw command, so your philosophy is incorrect. Even if you escaped the quotes around hello (or removed them) and added spaces around the brackets it still wouldn't work.

However, all is not lost. I'm pretty sure that you could use a -composite in place of the -draw because that's basically what it's doing anyway. I think this would work in place of your -draw "image .....":

Code: Select all

( -size 700x260 -background transparent -fill White -font Arial -pointsize 40 caption:"hello" ) -geometry +915+640 -compose over -composite
Pete

Re: Image Stack vs. temp files - "-draw" option

Posted: 2008-08-18T21:04:49-07:00
by fmw42
yes, -draw is more restrictive, but it ought to work in -composite.

Alternately, I am not sure, but you may get away with the following in a -draw, namely, use a string or its equivalent

-draw "image over 915,640 0,0 $(convert -size 700x260 -background transparent -fill White -font Arial -pointsize 40 caption:"hello")"

but then this is really doing two converts again, just in one command line

Re: Image Stack vs. temp files - "-draw" option

Posted: 2008-08-19T18:00:06-07:00
by stevepugh
Indeed, '-compose' with the image stack works just like I'd hoped. Thanks, y'all, for all of your help!!

Best,
Steve