Skip to content

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

License

Notifications You must be signed in to change notification settings

RafaPolit/node-red-contrib-image-average

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published