Parameters in a Text file: How to format?

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
rocketshiptech
Posts: 21
Joined: 2013-09-01T05:52:51-07:00
Authentication code: 6789

Parameters in a Text file: How to format?

Post by rocketshiptech » 2016-03-31T07:24:59-07:00

I understand ImageMagick Object can read a text file of parameters instead of having all of the parameters already compiled.

This is a typical command I’m running:

Code: Select all

strConvertResult = objMagImage.convert ("(", "c:\test1\Preprod\Trk1Seg65.png", "-repage", "+200+0", ")", "(", "c:\test1\Preprod\Trk1Seg66.png", "-repage", "+600+0", ")", "(", "c:\test1\Preprod\Trk1Seg67.png", "-repage", "+1000+0", ")", "(", "c:\test1\Preprod\Trk1Seg68.png", "-repage", "+1400+0", ")", "(", "c:\test1\Preprod\Trk1Seg69.png", "-repage", "+1800+0", ")", "(", "c:\test1\Preprod\Trk1Seg70.png", "-repage", "+2200+0", ")", "(", "c:\test1\Preprod\Trk1Seg71.png", "-repage", "+2600+0", ")", "(", "c:\test1\Preprod\Trk1Seg72.png", "-repage", "+3000+0", ")", "(", "c:\test1\Preprod\Trk1Seg73.png", "-repage", "+3400+0", ")", "-layers", "mosaic", "c:\test1\Preprod\TLTrack1.png")
I believe* it is the equivalent of this command line

Code: Select all

convert ( c:\test1\Preprod\Trk1Seg65.png -repage +200+0 ) ( c:\test1\Preprod\Trk1Seg66.png -repage +600+0 ) ( c:\test1\Preprod\Trk1Seg67.png -repage +1000+0 ) ( c:\test1\Preprod\Trk1Seg68.png -repage +1400+0 ) ( c:\test1\Preprod\Trk1Seg69.png -repage +1800+0 ) ( c:\test1\Preprod\Trk1Seg70.png -repage +2200+0 ) ( c:\test1\Preprod\Trk1Seg71.png -repage +2600+0 ) ( c:\test1\Preprod\Trk1Seg72.png -repage +3000+0 ) ( c:\test1\Preprod\Trk1Seg73.png -repage +3400+0 ) -layers mosaic c:\test1\Preprod\TLTrack1.png
(I say “believe” because currently ImageMagick Command line isn’t running on my machine, it keeps pulling up some DOS hard drive utility)

So two questions:
1 What would be the correct format of a text file for that ridiculously complex command line parameter?
2 How exactly do I call ImageMagick object to read the text file?
Thanks!

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

Re: Parameters in a Text file: How to format?

Post by snibgo » 2016-03-31T07:45:42-07:00

... currently ImageMagick Command line isn’t running on my machine, it keeps pulling up some DOS hard drive utility
convert.exe is the name of both IM's command and a Microsoft utility. Either rename the IM command, or put its directory first in your PATH, or call it with an explicit directory. For example, on my computer, %IM% is IM's directory, so I run "%IM%convert".


For your command, you could write the script file like this:

Code: Select all

( c:\test1\Preprod\Trk1Seg65.png -repage +200+0 )
( c:\test1\Preprod\Trk1Seg66.png -repage +600+0 )
( c:\test1\Preprod\Trk1Seg67.png -repage +1000+0 )
( c:\test1\Preprod\Trk1Seg68.png -repage +1400+0 )
( c:\test1\Preprod\Trk1Seg69.png -repage +1800+0 )
( c:\test1\Preprod\Trk1Seg70.png -repage +2200+0 )
( c:\test1\Preprod\Trk1Seg71.png -repage +2600+0 )
( c:\test1\Preprod\Trk1Seg72.png -repage +3000+0 )
( c:\test1\Preprod\Trk1Seg73.png -repage +3400+0 )
-layers mosaic
If that file is called a.scr, then:

Code: Select all

%IM%convert @a.scr c:\test1\Preprod\TLTrack1.png
I don't know Windows COM, but I suggest you try the obvious:

Code: Select all

strConvertResult = objMagImage.convert ("@s.scr", "c:\test1\Preprod\TLTrack1.png")
snibgo's IM pages: im.snibgo.com

rocketshiptech
Posts: 21
Joined: 2013-09-01T05:52:51-07:00
Authentication code: 6789

Re: Parameters in a Text file: How to format?

Post by rocketshiptech » 2016-05-26T05:43:00-07:00

Sorry for the necro but I'm finally around to using this and it doesn't work.

What this does is COPY each of the source files with the new names TLTrack1-0.png, TLTrack1-1.png, TLTrack1-2.png, TLTrack1-3.png
it doesn't combine them into one image.

I've spent hours just now trying different arrangements of parentheses, putting it all on one row, adding -append (in several places) I either get just copies of the source files or nothing at all.

rocketshiptech
Posts: 21
Joined: 2013-09-01T05:52:51-07:00
Authentication code: 6789

Re: Parameters in a Text file: How to format?

Post by rocketshiptech » 2016-05-26T05:51:01-07:00

UPDATE:
when I add - append to the actual IM object call like this:
strConvertResult = objMagImage.convert("@track.scr", "-append", strTLTrackDestFilePath)

THEN I do one file, but all the images are STACKED vertically, and not spaced out horizontally like the original command does,

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

Re: Parameters in a Text file: How to format?

Post by snibgo » 2016-05-26T06:10:24-07:00

What version of IM are you using? Sadly, @s.scr where s.scr contains "-repage" etc won't work in v7.

What command and/or script file doesn't work?

"-append" appends vertically. "+append" appends horizontally. But both will ignore the "-repage" setting.
snibgo's IM pages: im.snibgo.com

rocketshiptech
Posts: 21
Joined: 2013-09-01T05:52:51-07:00
Authentication code: 6789

Re: Parameters in a Text file: How to format?

Post by rocketshiptech » 2016-05-26T06:25:18-07:00

What version of IM are you using?
>I don't know, it was compiled from IM source code several(5+) years ago by other ppl on this project

What command and/or script file doesn't work?
> precisely the script you showed me, exactly that.

I then tried variations, without parens, all in one set of parens. all on one line, etc, etc, etc,

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

Re: Parameters in a Text file: How to format?

Post by snibgo » 2016-05-26T06:38:32-07:00

I don't know when scripts were introduced in IM. Perhaps your version is too old. "convert -version" should tell you the version number.

You might try a simple example first. For example, have s.scr contain just two images, with nothing else:

Code: Select all

c:\test1\Preprod\Trk1Seg65.png
c:\test1\Preprod\Trk1Seg66.png
Then have a simple command that appends them:

Code: Select all

strConvertResult = objMagImage.convert("@track.scr", "+append", strTLTrackDestFilePath)
Does this have any errors? Does it make an output file? Is it the two images appended sideways?
snibgo's IM pages: im.snibgo.com

rocketshiptech
Posts: 21
Joined: 2013-09-01T05:52:51-07:00
Authentication code: 6789

Re: Parameters in a Text file: How to format?

Post by rocketshiptech » 2016-05-26T06:47:34-07:00

our file date is 2008, although the IM copyright is 2006

yes that command works
but it does the exact same thing with and without the repage coordinates in there

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

Re: Parameters in a Text file: How to format?

Post by snibgo » 2016-05-26T07:11:13-07:00

OK, so @-script works. Good. Now add bits back in, testing gradually.

Put the images in parentheses.

Code: Select all

( c:\test1\Preprod\Trk1Seg65.png )
( c:\test1\Preprod\Trk1Seg66.png )
Does that still work?


Change "+append" to "-layers mosaic". Does this still work (though the image will look wrong)?


Add the repages.

Code: Select all

( c:\test1\Preprod\Trk1Seg65.png -repage +200+0 )
( c:\test1\Preprod\Trk1Seg66.png -repage +600+0 )
Does that still work?
snibgo's IM pages: im.snibgo.com

rocketshiptech
Posts: 21
Joined: 2013-09-01T05:52:51-07:00
Authentication code: 6789

Re: Parameters in a Text file: How to format?

Post by rocketshiptech » 2016-05-26T07:32:05-07:00

My experiments are well ahead of you.

"Change "+append" to "-layers mosaic".
already done. seems to just stack (in z axis) in *front* of each other. I see the last image w/ pieces of the other sticking out from behind it.

same with or without -repage

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

Re: Parameters in a Text file: How to format?

Post by snibgo » 2016-05-26T07:51:52-07:00

So, "-repage" doesn't work in script files in your version of IM.
snibgo's IM pages: im.snibgo.com

Post Reply