Node-RED function node that receives a valid JIMP input and outputs an array with [R, G, B] average values for the image

Downloads in past


0.1.26 years ago6 years agoMinified + gzip package size for node-red-contrib-image-average in KB


Implements a Node-RED function node that receives a valid JIMP input and outputs an array with R, G, B average values for the image.


  • source (string | buffer) : String to local file (not recommended), remote image URL or image buffer.


  • payload (array) : RGB values of the image average.

  • stats (object) : Basic stats with pixels used and time (in secs) employed from fetch to result.


The node uses, by default, the msg.payload as the source for the image average, or the source field.
The input can be a string with a path to a local file (not recommended), a remote URL address, or be an image buffer (for example fetched by the http request node).
The source field allows mustache-style tags to be constructed using values of the incoming message. For example, if the source is set to{{{topic}}}, it will have the value of msg.topic automatically inserted. Using {{{...}}} prevents mustache from escaping characters like / & etc.
Note: The node outputs the RGB values as a 3 item array in msg.payload. It also outputs a convenient msg.stats object so you evaluate the performance impact. The time (in secs) reported, consists of the combined time to fetch the image till the output is processed. Use as small an image as possible, as even small 64 x 64 pixel image can take up to a second to compute, depending on your hardware.