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:
- Take an image (on a remote server, so passed through with a URL) and get its dimensions
- Use dimensions to calculate the centre of the image
- Take a 10px x 50px (WxL) rectangle around the centre-point
- Get the RGB value for each of these pixels (500 per image)
- 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.
(a) Is this possible with Node?
(b) What libraries will allow me to do this?
here are some more characters to make this long enough for stackoverflow...
This recipe can be found in it's original form on Stack Over Flow.