Reputation: 93
I am trying to improve the quality of a scanned PDF to proceed to OCR. I found the command textcleaner that uses ImageMagick. So how can I include this :
textcleaner -g -e normalize -f 30 -o 12 -s 2 original.jpg output.jpg
in my Nodejs code ?
Upvotes: 0
Views: 1470
Reputation: 1892
you can use exec
:
exec(`textcleaner -g -e normalize -f 30 -o 12 -s 2 ${inputName} ${outputName}`);
or use a child process
const { spawn } = require('child_process');
const textcleaner = spawn('textcleaner', ['-g', '-e', 'normalize', '-f 30', '-o 12', '-s 2', inputName, outputName]);
textcleaner.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
Upvotes: 1