Page 1 of 1

montage with spaces in filenames

Posted: 2012-08-01T01:15:41-07:00
by seiko
Hello.
I am using this command
p.StartInfo.Arguments = @"montage -tile 9x1 -geometry +0+0 ";
for(i = 0; i < 9; i++)
p.StartInfo.Arguments += " " + pathImages;
p.StartInfo.Arguments += " " + subdir + @"\final.jpeg ";

Here i am adding 9 jpg files from pathImages but it doesnt work if the images have spaces in names. How can i solve this?
Ex:
p.StartInfo.Arguments = @"montage -tile 9x1 -geometry +0+0 p11.jpg p22.jpg final.jpg "; OK
p.StartInfo.Arguments = @"montage -tile 9x1 -geometry +0+0 p1 1.jpg p22.jpg final.jpg "; WRONG because: p1 1.jpg image.

Thanks!

Re: montage with spaces in filenames

Posted: 2012-08-01T01:51:27-07:00
by Bonzo
I do not know how you will get over the problem as you are using a programing laungage I do not know. But in php and windows I would put " " around the filename.

Re: montage with spaces in filenames

Posted: 2012-08-01T02:09:59-07:00
by seiko
After a loooong search this is final version and it is working fine. I put the code here, maybe somebody will need too.

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.FileName = readDataFromConfigFile("MagicExePath") + @"\MagickCMD.exe"; //read MagicCMD.exe path
p.StartInfo.Arguments = @"montage -tile 9x1 -geometry +0+0 ";
for(i = 0; i < 9; i++)
p.StartInfo.Arguments += " " + (char)34 + pathImages + (char)34; //pathImages contains the address of the images
p.StartInfo.Arguments += " " + (char)34 + subdir + @"\final.jpeg" + (char)34; //the name for the final image
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();