Question

I have ImageMagick and GraphicsMagick both installed. I can use both freely from the command line because they have different command namespaces (all of the ImageMagick commands are parameters to the gm GraphicsMagick command). From the command line:

  • convert ... uses ImageMagick
  • gm convert ... uses GraphicsMagick

That all works fine. However, it appears that both programs' COM objects are invoked identically:

  • Set img = CreateObject("ImageMagickObject.MagickImage.1") creates an ImageMagick object
  • Set img = CreateObject("ImageMagickObject.MagickImage.1") creates a GraphicsMagick object... hard to believe, but this is straight from the GraphicsMagick SimpleTest.vbs sample script

How do I specify which COM object I want to use? Or am I out of luck?

EDIT: I just compared the sample VBS scripts that are included with ImageMagick and GraphicsMagick, both named SimpleTest.vbs. Turns out they have more in common than the filename. They are nearly identical files. This in itself may not mean much (after all, GM was forked from IM), but I'm starting to wonder whether GraphicsMagick really has a COM object at all or whether they are just including ImageMagick's COM object in their Windows binary.

Was it helpful?

Solution

I asked this question on the GraphicsMagick mailing list: Why is the GraphicsMagick COM object called ImageMagick? Here is part of Bob Friesenhahn's response:

I agree it is confusing. GraphicsMagick does offer a COM object. The history is interesting. The original ImageMagickObject was developed under the GraphicsMagick project by the same author as the original ImageMagickObject. The current ImageMagickObject was developed under the GraphicsMagick project and Bill Radcliffe retained the original name.

I am not aware of a way to specify using a particular ImageMagickObject COM implementation if both are registered. Is it even possible to register two COM objects under the same name at once?

As far as being able to tell which one is in use at run time, it seems that passing the argument '-version' might be used to return some useful info.

If I understand COM correctly, I believe this basically means that whichever library was registered most recently--ImageMagick or GraphicsMagick--will be the one called from within the code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top