VBS: How to use Parenthesis to isolate affects of operators

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cativo
Posts: 3
Joined: 2012-11-21T10:12:54-07:00
Authentication code: 6789

VBS: How to use Parenthesis to isolate affects of operators

Post by cativo »

Using parenthesis, \(Image1.jpg image2.jpg -operator1 -operator2\) to isolate the affect of operators to just specific image lists is explained here http://www.imagemagick.org/Usage/basics/#parenthesis. The parenthesis are escaped by "\' for unix, but for DOS it is not required.

How do you do this in VBS?

I tried enclosing enclosing everything in quotes separated by commas, including the "(" and ")", but it doesn't seem to work. For example:

Code: Select all

objImageMagick_01.Convert "-background", "none", "-fill", "white", "-font", "Arial", "-pointsize", "90", "label:test", "(","+clone","-background","red","-shadow","200x3+0+0",")","+swap","-background","none","-layers","merge","+repage", "c:\test.png"
Any ideas?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: VBS: How to use Parenthesis to isolate affects of operat

Post by fmw42 »

Be sure to leave a space around each ( and )

I am not a windows or vbs user, so this may be special to vbs, but IM command lines do not include commas between settings or options.
cativo
Posts: 3
Joined: 2012-11-21T10:12:54-07:00
Authentication code: 6789

Re: VBS: How to use Parenthesis to isolate affects of operat

Post by cativo »

Thanks, but I don't think that fixed the problem. I beleive it is crucial to have the spaces for DOS scripting, not sure about VBS.

I actually found my problem. The parenthesis were located in the wrong positions, so the operators were being isolated incorreclty, yielding a different result.

Just for reference, here is a DOS and VBS equivalent that give the same result, in case anyone is having the same problem.

This script takes imageIn.jpg and applies a clut (Color Look Up Table) to colorize it, but before doing so, shifts only the clut image lut.jpg 100 pixels vertically. Without the parenthesis, the -roll operation would occur on both the imageIn.jpg and the lut.jpg images.

DOS example:

Code: Select all

convert imageIn.jpg ( lut.jpg -roll +0+100 ) -clut imageOut.jpg
Make sure there are spaces on each side of the parenthesis.

VBS example:

Code: Select all

set image = CreateObject("ImageMagickObject.MagickImage.1")
image.convert "imageIn.jpg", "(", "lut.jpg", "-roll", "+0+100", ")", "-clut", "imageOut.jpg"
Post Reply