Created
February 10, 2014 22:01
-
-
Save memorycraft/8925118 to your computer and use it in GitHub Desktop.
gm:合成処理のモジュール化
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//合成処理のモジュール化 | |
var spawn = require('child_process').spawn | |
var fs = require('fs'); | |
//子プロセスで処理 | |
var gmcomposite = function(change_path, base_path, mask_path, output_path, callback) { | |
var c = spawn('gm', ['composite', '-quality', 100, '-geometry', '+0+0', change_path, base_path, output_path]); | |
c.stderr.on('data', function(data) { | |
console.log('stderr: ' + data); | |
}) | |
c.on('exit', function(code) { | |
if (code !== 0) callback(code, null) | |
else callback(null, null) | |
}) | |
}; | |
//モジュール出力 | |
module.exports = gmcomposite; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment