imagemagick - How do I get Node.js graphicsmagick color reduction to work? -
i in cloud9 environment on c9.io , have sucessfully installed graphicsmagick , node.js gm module. have been successful in calling number of methods have not. 1 specific 1 having problem color reduction method (colors).
has been able call colors , reduce colors in source image? documentation states usage is: gm("img.png").colors(int) can't seem work , wondering if has used this.
i have provided reduced code block give idea how i'm using in hopes see perhaps doing wrong. in data event handler, still have way more colors being shown in passed "chunk" param reduced amount of 8 in case.
thanks!
var img = gm(sourcefilename), tmpfilename = temp.path({ suffix: '.miff' }); return img.noprofile().bitdepth(8).colors(8).scale(math.ceil(wh.height / ratio), max_w).write('histogram:' + tmpfilename, function (err) { var histogram, rs; histogram = ''; rs = fs.createreadstream(tmpfilename, {encoding: 'utf8'}); rs.addlistener('data', function (chunk) { console.log("data: ", chunk); }); });
ok issue seems "scale". @ time seems scale , resize (i tested) both not working correctly. when removed scale line shown below, getting color reduced histogram data expecting.
return img.noprofile().bitdepth(8).colors(8).write('histogram:' + tmpfilename, function (err)
Comments
Post a Comment