Jascination Jascination - 1 month ago 27
Javascript Question

Is NodeJS Image Processing/Analysis Possible?

I'm running

NodeJS
on the server-side, and I'm trying to do a bit of automated image processing to determine the 'base colour' of an image.

Here are the steps of what I want to do:


  1. Take an image (on a remote server, so passed through with a URL) and get its dimensions

  2. Use dimensions to calculate the centre of the image

  3. Take a 10px x 50px (WxL) rectangle around the centre-point

  4. Get the RGB value for each of these pixels (500 per image)

  5. Output the average value of the pixels



I know such things are possible in PHP, but I'd like to use Node is possible. I've seen tutorials on using
Node-imagick
for basic processing (like resizing and cropping) but don't know where to start with more advanced analysis like this.

Questions

(a) Is this possible with Node?

(b) What libraries will allow me to do this?

Answer

A: yes

B: gm

here are some more characters to make this long enough for stackoverflow...