How to getPixel using Node.js gm graphicsMagick wrapper -


im trying figure out how individual pixel using node.js gm graphicsmagic wrapper. overall end goal top 10 colors percentages in image. trying write few functions me result life of me can't figure out hwo pixel using gm wrapper. seems graphicsmagick has getpixels method havent had luck being able call it. appreciated.

thanks!

i wanted average color of image , solved following script:

gm(file).setformat('ppm')     .resize(1, 1)     .tobuffer(function (err, buffer) {         var color = "rgb(" + buffer.readuint8(buffer.length - 3)             + "," + buffer.readuint8(buffer.length - 2)             + "," + buffer.readuint8(buffer.length - 1) + ")";         // ...     }); 

basically, crop image , convert ppm format read pixels buffer. not optimal @ , hope there better solution, case enough.

edit: option might use custom arguments.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -