Page 1 of 1

COM object noob question

Posted: 2017-09-01T11:58:03-07:00
by dukenukem89
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

Re: COM object noob question

Posted: 2017-09-02T06:10:22-07:00
by snibgo
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.

Re: COM object noob question

Posted: 2017-09-03T11:46:00-07:00
by dukenukem89
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.