node-red-contrib-image-average

0.1.2 • Public • Published

node-red-contrib-image-average

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.

Inputs

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

Outputs

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

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

Details

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 example.com/{{{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.

Package Sidebar

Install

npm i node-red-contrib-image-average

Weekly Downloads

30

Version

0.1.2

License

MIT

Unpacked Size

9.6 kB

Total Files

7

Last publish

Collaborators

  • rafapolit