Page 1 of 1

How do I use VB script?

Posted: 2014-08-18T08:53:37-07:00
by RCinSTP
Can someone please help a newbie out and help me understand how to use VB script with ImageMagick. How do you run the script? Do you use VBA and run it from a VBA editor like the one in Microsoft Word? I would like to use the Montage / Tile command with many files and I would like to write a script to use a number range for the file names instead of typing each individual file name.

Re: How do I use VB script?

Posted: 2014-08-18T08:59:49-07:00
by snibgo
As this is a question about Visual Basic, I'm moving it to the Visual Basic forum. There are examples in that forum.

Re: How do I use VB script?

Posted: 2018-03-29T20:26:59-07:00
by Alexvb6
Hi,

The basic syntax for using IM in VBScript is the following.
The "classic batch" command line parameters are separated by spaces, and to use them in VbScript, you have to enclose them as strings, as explained here :
http://www.imagemagick.org/script/ImageMagickObject.php

Code: Select all

set o_objIMG = CreateObject("ImageMagickObject.MagickImage.1")
	o_objIMG.Convert("c:\source.png", "-resize", "50%x25%", "c:\destination.jpg")
set o_objIMG = Nothing
You use the other tools the same way :

Code: Select all

o_objIMG.Composite
o_objIMG.Montage
and so on...

You will also find basic examples in the folder you have installed IM.
For example :
C:\Program Files\ImageMagick-7.0.7-Q16-HDRI\ImageMagickObject\Tests