Hi there,
I've been attempting to write a very simple VBScript which uses ImageMagick to convert from one format into another.
Such that an JPEG arrives in a folder > Switch picks it up > converts to a PNG file. The original filename will be unknown.
I would very much appreciate any help given here, as I've achieved roughly nothing!
Thanks in advance
ImageMagick Conversion
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
ImageMagick Conversion
You shouldn't need to write VBscript to call ImageMagick or GraphicMagick. Use the Execute Command configurator and set the properties to:
Command: convert
Arguments: "%1" "png:%3/[Job.NameProper].png"
Output: Result in folder
Command: convert
Arguments: "%1" "png:%3/[Job.NameProper].png"
Output: Result in folder
ImageMagick Conversion
Thanks for that, I've got that part working. But I really just wanted to get the VBScript part working for more complex tasks.
Such as one script outputting to multiple folders.
I've struggled to get it working at all, which is why I went with a basic task. Any pointers would be much appreciated.
Such as one script outputting to multiple folders.
I've struggled to get it working at all, which is why I went with a basic task. Any pointers would be much appreciated.
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
ImageMagick Conversion
I can't help with VBscript as I use Javascript exclusively for Switch development.
ImageMagick Conversion
Would be grateful for an example in JavaScript, should be able to figure it out from there.
Thanks!
Thanks!
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
ImageMagick Conversion
// GraphicsMagick convert script
// (c) 2012 by Apago, Inc. - All rights reserved
// Created by Dwight Kelly <dkelly@apago.com>
// Date: 2012/08/22
//
function jobArrived( s : Switch, job : Job )
{
var outputPath = job.createPathWithExtension(".png", false);
var String args = new Array();
args[0] = "/opt/local/bin/convert";
args[1] = job.getPath();
args[2] = "png:" + outputPath;
var exitStatus = Process.execute(args);
if (exitStatus == 0) {
job.sendToSingle(outputPath);
return;
}
job.fail("convert failed!");
}
// (c) 2012 by Apago, Inc. - All rights reserved
// Created by Dwight Kelly <dkelly@apago.com>
// Date: 2012/08/22
//
function jobArrived( s : Switch, job : Job )
{
var outputPath = job.createPathWithExtension(".png", false);
var String args = new Array();
args[0] = "/opt/local/bin/convert";
args[1] = job.getPath();
args[2] = "png:" + outputPath;
var exitStatus = Process.execute(args);
if (exitStatus == 0) {
job.sendToSingle(outputPath);
return;
}
job.fail("convert failed!");
}