How do I use VB script?

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
RCinSTP
Posts: 21
Joined: 2014-08-18T07:42:44-07:00
Authentication code: 6789

How do I use VB script?

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do I use VB script?

Post 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.
snibgo's IM pages: im.snibgo.com
Alexvb6
Posts: 49
Joined: 2012-10-12T16:50:15-07:00
Authentication code: 67789

Re: How do I use VB script?

Post 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
Post Reply