Skip to content

Node-RED Image Processing Toolkit

A comprehensive Node-RED package providing 16 specialized nodes for high-performance image processing using C++ OpenCV backend. Perfect for computer vision workflows, batch processing, and automated image manipulation.

Demo

🚀 Quick Start

Installation

bash
# Quick setup
./install.sh

# Manual installation
cd rosepetal-image-engine && npm install && npm run build
cd ../node-red-contrib-rosepetal-image-tools && npm install
cd ~/.node-red && npm install /path/to/node-red-contrib-rosepetal-image-tools

Requirements

  • Node.js 16+ with node-gyp support
  • OpenCV 4.x (auto-detected via pkg-config)
  • C++ compiler with C++17 support

📋 Node Categories

🔄 I/O Nodes - Data Flow Management

NodePurposeKey Features
image-inLoad images from filesystemJPEG/PNG/WebP/etc. support, Sharp backend
array-inCollect data into positioned arraysDynamic positioning, batch collection
array-outAssemble arrays from multiple sourcesTimeout protection, ordered assembly
array-selectExtract elements with flexible selectionPython-like slicing, range selection

🔧 Transform Nodes - Image Processing

NodePurposeKey Features
resizeScale images with aspect ratio controlProportional scaling, multiple modes
rotateRotate images with custom paddingSub-pixel precision, background colors
cropExtract regions with pixel/normalized coordsDynamic coordinates, bounds checking
paddingAdd configurable marginsColor customization, flexible sizing
filterApply enhancement filtersBlur, sharpen, edge, emboss, Gaussian

🎨 Mix Nodes - Image Composition

NodePurposeKey Features
concatCombine images horizontally/verticallyDirection control, padding strategies
mosaicPosition images on canvasCoordinate positioning, manual placement
advanced-mosaicComplex layouts with custom positioningPixel-perfect control, layering

🌈 Blend Nodes - Advanced Compositing

NodePurposeKey Features
blendAlpha blend two images with opacityBackground removal, color tolerance
add-maskApply polygon-based masks to regionsCoordinate arrays, mask strength control

🤖 Specialized Nodes - AI/ML Integration

NodePurposeKey Features
cropBBExtract crops from AI bounding boxesObject detection integration, confidence filtering

🔥 Real-World Use Cases

Computer Vision Pipeline

[Camera] → [AI Detection] → [CropBB] → [Classification] → [Decision]

Perfect for quality control, security systems, and medical imaging.

Batch Photo Processing

[Photo Collection] → [Array-Out] → [Resize] → [Filter] → [Watermark] → [Export]

Process hundreds of photos simultaneously with C++ performance.

🏗️ Architecture & Performance

Two-Tier Design

  • JavaScript Layer: Node-RED integration, validation, I/O handling
  • C++ Layer: OpenCV-powered image processing for maximum performance

Performance Benefits

  • 10-100x faster than pure JavaScript implementations
  • Parallel processing for array operations
  • Memory efficient with optimized algorithms
  • Async operations with real-time performance timing

Image Data Format

javascript
{
  data: Buffer,        // Raw pixel data
  width: number,       // Image width in pixels  
  height: number,      // Image height in pixels
  channels: number,    // Channel count (1, 3, 4)
  colorSpace: string,  // "GRAY", "RGB", "RGBA", "BGR", "BGRA"
  dtype: string        // "uint8" (standard)
}

💡 Key Features

🎯 AI/ML Ready

Built-in support for computer vision workflows with cropBB node for object detection integration.

High Performance

C++ backend delivers professional-grade speed for production workflows.

🔧 Flexible I/O

Dynamic path configuration supports msg, flow, and global contexts for complex workflows.

📐 Professional Quality

Multiple output formats (Raw/JPEG/PNG/WebP) with quality control.

🔗 Workflow Integration

Designed for Node-RED patterns with array processing, error handling, and status display.

🛠️ Development

Project Structure

node-red-contrib-rosepetal-image-tools/
├── docs/nodes/          # Individual node documentation
├── nodes/              # Node-RED node implementations
│   ├── io/             # I/O nodes
│   ├── transform/      # Transform nodes  
│   ├── mix/            # Composition nodes
│   ├── blend/          # Blending nodes
│   └── specialized/    # AI/ML nodes
├── lib/                # Shared utilities
└── assets/             # Documentation assets

rosepetal-image-engine/  # C++ processing engine
├── src/                # OpenCV implementations
├── binding.gyp         # Node.js addon configuration
└── package.json

Adding New Nodes

  1. Implement C++ processing in rosepetal-image-engine/src/
  2. Export function in src/main.cpp
  3. Create Node-RED wrapper in appropriate nodes/ category
  4. Add comprehensive documentation following existing patterns

🚨 Troubleshooting

Common Issues

  • Build Failures: Ensure OpenCV 4.x installed and pkg-config available
  • Missing Nodes: Check Node-RED installation path and package registration
  • Performance Issues: Verify C++ addon built with optimization flags
  • Memory Problems: Process large images in smaller batches

Performance Tips

  • Use raw format for processing chains (fastest)
  • Process arrays when possible for parallel execution
  • Choose appropriate output formats for your destination
  • Monitor node status displays for timing information

🤝 Contributing

  • Issues: Report bugs and feature requests via GitHub
  • Pull Requests: Contributions welcome for new nodes and optimizations
  • Documentation: Help improve guides and examples

📄 License

This project is part of the Rosepetal development toolkit for Node-RED image processing applications.


💡 Pro Tip: Start with simple single-node workflows, then combine them into complex processing pipelines as you become familiar with the image format and node interactions.