Skip to content

Instantly share code, notes, and snippets.

@rotespferd
Created May 10, 2013 21:18
Show Gist options
  • Save rotespferd/5557493 to your computer and use it in GitHub Desktop.
Save rotespferd/5557493 to your computer and use it in GitHub Desktop.
Converts all images in a directory from .xcf to .png.
#!/usr/local/bin/node
var fs = require('fs');
var sys = require('sys');
var exec = require('child_process').exec;
console.log("Start converting");
var command = "convert -flatten ";
fs.readdir(".", function (err, files) {
for(var i in files) {
var convCommand = command + files[i] + " " + files[i].split(".")[0] + ".png";
console.log(convCommand);
function puts(error, stdout, stderr) { sys.puts(stdout) };
exec(convCommand, puts);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment