COM object noob question

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
dukenukem89
Posts: 2
Joined: 2017-09-01T11:51:04-07:00
Authentication code: 1151

COM object noob question

Post by dukenukem89 » 2017-09-01T11:58:03-07:00

Hello, I've got a piece of code that's not working :(

Code: Select all

compList := objIM.convert(fname
	, "-colorspace", "gray"
	, "-negate"
	, "-threshold", "5%"
	, "-define", "connected-components:verbose=true"
	, "-define", "connected-components:area-threshold=300"
	, "-connected-components", "8"
	, "info:")
I've ruled out obvious syntax errors since I've gotten less complicated commands working just fine, so what did I screw up here? I'm trying to emulate this command:

Code: Select all

convert.exe somefile.jpg -colorspace gray -negate -threshold 5% -define connected-components:verbose=true -define connected-components:area-threshold=300 -connected-components 8 info:- > tempfile.tmp

snibgo
Posts: 9391
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: COM object noob question

Post by snibgo » 2017-09-02T06:10:22-07:00

I can't see an obvious problem. What does "not working" mean? What are the symptoms? Is '%' a special character in VB?

I suggest you eliminate code to find the minimum that shows the problem.
snibgo's IM pages: im.snibgo.com

dukenukem89
Posts: 2
Joined: 2017-09-01T11:51:04-07:00
Authentication code: 1151

Re: COM object noob question

Post by dukenukem89 » 2017-09-03T11:46:00-07:00

It doesn't throw any errors but returns an empty string. I'm using AHK and % is a special character there but it's not supposed to do anything inside quotes. I've checked and some of the working COM calls I have use unescaped % characters without problems.

Edit: I've tinkered with it a bit and now it does return a string, but it's only width, height and format of the image (e.g. 96,240,PNG). Interestingly when I run my app from command line, the correct IM output shows up there. It also shows up in a file when I modify the last arg like "info:somefile.txt", but that's not a performance improvement over non-COM usage.

Post Reply