Page 1 of 1
Parameters in a Text file: How to format?
Posted: 2016-03-31T07:24:59-07:00
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!
Re: Parameters in a Text file: How to format?
Posted: 2016-03-31T07:45:42-07:00
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")
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T05:43:00-07:00
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.
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T05:51:01-07:00
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,
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T06:10:24-07:00
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.
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T06:25:18-07:00
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,
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T06:38:32-07:00
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?
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T06:47:34-07:00
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
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T07:11:13-07:00
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?
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T07:32:05-07:00
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
Re: Parameters in a Text file: How to format?
Posted: 2016-05-26T07:51:52-07:00
by snibgo
So, "-repage" doesn't work in script files in your version of IM.