Getting started

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
dizwell

Getting started

Post by dizwell »

Sorry if this is very, very basic.

I have been issuing commands at the Windows command line, such as

Code: Select all

convert C:\Pictures\19732685.jpg -format %c -colors 10 -depth 8 histogram:info:- >> C:\Pictures\analysis.txt
...and getting a nice histogram of the top ten colours in an image. Now I'm trying to put that into a VBscript, and getting nowhere.

So far, I have:

Code: Select all

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set img = CreateObject("ImageMagickObject.MagickImage.1")
Set WshShell = WScript.CreateObject("WScript.Shell")
img.Convert "C:\Pictures\19732685.jpg","-format","%c","-colors","5","-depth", "8", "histogram", "C:\Pictures\analysis.txt"
...but this outputs a lengthy pixel enumeration, not a histogram. I got the idea of sticking all the variables in as comma-separated switches from a million different searches on Google and one or two posts here. But clearly, it's not the right thing to do!

How can I get my original command prompt command to work in VBScript?
Is there any documentation of generally converting command line success stories into VBscript?
Post Reply