node.js - How to pass multiple arguments in node imagemagick module convert function -
i using node imagemagick module's convert function when using command through terminal working fine
convert /home/manish/downloads/new_images/slim_fit_double_breasted_coat_base.png /home/manish/desktop/medium-vichy-9274-fabric-gauloise-058.jpg \( -clone 0 -auto-level \) \( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace -set option:compose:args -5x-5 -composite \) fabric2.png
but when passing same command in node module not giving expected result.
here code
var im = require('imagemagick'); im.convert(['/home/manish/downloads/new_images/slim_fit_double_breasted_coat_base.png','/home/manish/desktop/green-flower-lavender-eye-pillow-fabric.jpg', '-clone', '0', '-auto-level','-clone','1','-clone','0','-alpha' , 'set' ,'-virtual-pixel','transparent','-compose','displace','-set','option:compose:args -5x-5 ','-composite','fabricted111.png'], function (err, stdout) { if (err) throw err; console.log('stdout:', stdout); });
it giving error @ argument
'-set','option:compose:args -5x-5 ','-composite'
looks code missing image-stack operator \( ... \)
, code not match cli command.
command = ['/home/manish/downloads/new_images/slim_fit_double_breasted_coat_base.png', '/home/manish/desktop/green-flower-lavender-eye-pillow-fabric.jpg', '\\(', // <--- missing ( '-clone', '0', '-auto-level', '\\)', // <--- missing ) '\\(', // <--- missing ( '-clone', '1', '-clone', '0', '-alpha', 'set', '-virtual-pixel', 'transparent', '-compose', 'displace', '-set', 'option:compose:args -5x-5 ', '-composite', '\\)', // <--- missing ) 'fabricted111.png']; im.convert(command, function (err, stdout) { if (err) throw err; console.log('stdout:', stdout); });
Comments
Post a Comment