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 »

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: 12159
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 »

... 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 »

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 »

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: 12159
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 »

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 »

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: 12159
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 »

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 »

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: 12159
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 »

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 »

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: 12159
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 »

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