Created
February 28, 2016 13:52
-
-
Save yamano/2e6679a8850172dd4219 to your computer and use it in GitHub Desktop.
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
<!-- node line_image.js input.jpg output.png --> | |
const HEIGHT = 370; | |
const WIDTH = 320; | |
if (process.argv.length < 4) { | |
console.log('missing argument.'); | |
return; | |
} | |
var gm = require('gm').subClass({ imageMagick: true }); | |
gm(process.argv[2]) | |
.fuzz('20%') | |
.trim() | |
.resize(HEIGHT, WIDTH) | |
.extent(HEIGHT, WIDTH) | |
.fuzz('10%') | |
.fill('#00000000') | |
.setDraw('matte', 1, 1, 'floodfill') | |
.setDraw('matte', 1, WIDTH - 1, 'floodfill') | |
.setDraw('matte', HEIGHT - 1, 1, 'floodfill') | |
.setDraw('matte', HEIGHT - 1, WIDTH - 1, 'floodfill') | |
.write(process.argv[3], function (err) { | |
if (!err) console.log(process.argv[2] + " -> " + process.argv[3]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment