morphology problem, syntax?

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
Kjartan
Posts: 2
Joined: 2011-09-12T05:21:56-07:00
Authentication code: 8675308

morphology problem, syntax?

Post by Kjartan »

Code: Select all

	dim Img, strResult, str
	Set Img = Server.CreateObject("ImageMagickObject.MagickImage.1")
		strResult = Img.Convert(redRC, _
								"-threshold=99%",_
								"+depth",_
								"-morphology","Distance Euclidean:1,67000",_
								"-morphology","Close Disk",_
								"-morphology","Open Disk",_	
								"-auto-level",_
								"+matte",_
								"-negate",_
								whiteM)
Hello, I am having a great big deal of trouble with this code, if I remove the morphology, everything works. And I am wondering if the syntax here is way off.

Thank you very much.
- Kjartan
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: morphology problem, syntax?

Post by anthony »

Kjartan wrote: Hello, I am having a great big deal of trouble with this code, if I remove the morphology, everything works. And I am wondering if the syntax here is way off.

Thank you very much.
- Kjartan
I am not familar with vb code (actually this is the first time I responded to this forum!) but I would have expected the arguments to break up the same way as you would with the Command Line version. Actually I am pretty sure of it as I have seen some code for this.

I have no idea what the underscores on the end of line mean, I assume line continuation, so I have left them in.

The distance scaling value of 67000 is excesivally high, unless you are using a Q32 version of ImageMagick!

By default a factor of 100 is used (two decimal places) and this is plenty, the iteration errors of the kernel are larger that 100 decimal places. BUt it is too big if you are using Q8 version which really can't handle a floating point distance function

Code: Select all

	dim Img, strResult, str
	Set Img = Server.CreateObject("ImageMagickObject.MagickImage.1")
		strResult = Img.Convert(redRC,_
								"-threshold", 99%",_
								"+depth",_
								"-morphology", "Distance", "Euclidean",_
								"-morphology", "Close", "Disk",_
								"-morphology", "Open", "Disk",_	
								"-auto-level",_
								"+matte",_
								"-negate",_
								whiteM)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply