有什么方法可以区分 ImageMagick 和 GraphicsMagick COM 对象吗?
我安装了 ImageMagick 和 GraphicsMagick。我可以从命令行自由使用两者,因为它们具有不同的命令命名空间(所有 ImageMagick 命令都是 gm
GraphicsMagick 命令的参数)。从命令行:
convert ...
使用 ImageMagickgm Convert ...
使用 GraphicsMagick
一切正常。但是,两个程序的 COM 对象的调用方式似乎相同:
Set img = CreateObject("ImageMagickObject.MagickImage.1")
创建一个 ImageMagick 对象Set img = CreateObject("ImageMagickObject.MagickImage .1")
创建一个 GraphicsMagick 对象...难以置信,但这直接来自 GraphicsMagickSimpleTest.vbs
示例脚本
如何指定要使用哪个 COM 对象?还是我运气不好?
编辑:我刚刚比较了 ImageMagick 和 GraphicsMagick 中包含的示例 VBS 脚本,它们都名为 SimpleTest.vbs。事实证明,它们除了文件名之外还有更多共同点。它们是几乎相同的文件。这本身可能没有多大意义(毕竟,GM 是从 IM 分叉出来的),但我开始怀疑 GraphicsMagick 是否真的有 COM 对象,或者他们是否只是在 Windows 二进制文件中包含 ImageMagick 的 COM 对象。
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 ImageMagickgm 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 objectSet img = CreateObject("ImageMagickObject.MagickImage.1")
creates a GraphicsMagick object... hard to believe, but this is straight from the GraphicsMagickSimpleTest.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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 GraphicsMagick 邮件列表上提出了这个问题: 为什么 GraphicsMagick COM 对象称为 ImageMagick? 以下是 Bob Friesenhahn 的部分回复:
如果我正确理解 COM,我相信这基本上意味着最近注册的库(ImageMagick 或 GraphicsMagick)将是从代码中调用的库。
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:
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.