Jascination Jascination - 4 months ago 69
Javascript Question

Is NodeJS Image Processing/Analysis Possible?

I'm running

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
for basic processing (like resizing and cropping) but don't know where to start with more advanced analysis like this.


(a) Is this possible with Node?

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


A: yes

B: gm

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