Skip to content

Instantly share code, notes, and snippets.

@saintedlama
Last active August 29, 2015 13:56
Show Gist options
  • Save saintedlama/9038786 to your computer and use it in GitHub Desktop.
Save saintedlama/9038786 to your computer and use it in GitHub Desktop.
Enhance camera "scanned" documents with gm
var gm = require('gm');
if (process.argv.length != 4) {
console.log('Usage: enhancescan input output');
process.exit(2);
}
var input = process.argv[2];
var output = process.argv[3];
gm(input)
.type('Grayscale')
.level(40, 1, 120)
.write(output, function (err) {
if (err) { return console.log(err); }
console.log('Enhanced scan written to', output);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment