JScript and identify

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

JScript and identify

Post by gkalt »

I want to use identify from JScript via ImageMagickObject. If I run identify on an image directly from the command line, it works. But, if I run the same command through MagickCmd, I see no output.

For example,

Code: Select all

>identify foo.gif
foo.gif GIF 153x76 153x76+0+0 8-bit PseudoClass 64c 1.93KB 0.000u 0:00.0.15

>MagickCmd identify foo.gif

>■
Similarly, via JScript, the following produces no results.

Code: Select all

var im = WScript.CreateObject( "ImageMagickObject.MagickImage.1" );
var msgs = im.Identify( "foo.gif" );
WScript.Echo( msgs );
What am I doing wrong?
spieler
Posts: 47
Joined: 2004-10-08T09:03:16-07:00
Location: Iowa

Re: JScript and identify

Post by spieler »

I've had varying degrees of success with MagickCmd, so I wouldn't be too worried about that. I don't recall every having received an actual error message from it.

That being said, I ran your jscript and it worked fine on my machine. I'm currently on 6.5.4-10 on Vista. What version are you on? Also, did you install the ImageMagickObject when you installed IM? It is not installed by default.

Gary
gkalt

Re: JScript and identify

Post by gkalt »

spieler wrote:I've had varying degrees of success with MagickCmd, so I wouldn't be too worried about that. I don't recall every having received an actual error message from it.

That being said, I ran your jscript and it worked fine on my machine. I'm currently on 6.5.4-10 on Vista. What version are you on? Also, did you install the ImageMagickObject when you installed IM? It is not installed by default.
I'm more concerned about a basic identify command returning no results when accessed using MagickCmd. Does that work for you?

I'm using 6.5.8-10 on XP SP3. Yes, IMO is installed.
spieler
Posts: 47
Joined: 2004-10-08T09:03:16-07:00
Location: Iowa

Re: JScript and identify

Post by spieler »

I tried MagickCMD on a couple of different computers and it didn't work either place.

What I did do was create a file called test.js

Code: Select all

var im = WScript.CreateObject("ImageMagickObject.MagickImage.1");
var msgs = im.Identify("rose:");
WScript.Echo("\"" + msgs + "\"");
//See SimpleTestIdentify.vbs
var msgs = im.Identify("-format", "%m", "rose:");
WScript.Echo("\"" + msgs + "\"");
and then called it with
cscript //nologo test.js

It produced

rose:=>ROSE ROSE 70x46 70x46+0+0 8-bit DirectClass 9.45kb
"undefined"
"ROSE"

What this shows is that if you do not use a specific "-format" parameter (which I've always used since day one, so never noticed this), instead of returning as the output to the message, it actually writes to standard out. Use -format and you should be good to go.

I'll post to the bugs forum about this. If you want to pursue the MagickCmd problem, I'll let you post on the bug forum for that one.

Gary
Post Reply