Skip to content

Image Sink ​

The image sink saves binary camera frame payloads (JPEG or PNG) directly to local storage directories with automated age-based (maxAge) and count-based (maxCount) retention pruning.

In rekuiper, the Image sink is a built-in component that writes image files using asynchronous disk operations.

Configuration Properties ​

Configure the image sink action using the following properties:

Property NameTypeRequiredDefaultDescription
pathStringYes-Target directory path for saved images (e.g. /tmp/images or /tmp/images/{{.deviceId}}).
formatStringNojpegImage format: jpeg, jpg, or png.
imageFieldStringNoautoName of the field containing binary bytes or a base64 encoded string. If omitted, searches image, image_bytes, data, and payload.
fileNameStringNoautoOptional file name template (e.g. frame_{{.deviceId}}_{{.ts}}.png). If omitted, generates uuid.format.
maxAgeIntegerNo72Maximum retention time in hours. Files older than this threshold are pruned.
maxCountIntegerNo1000Maximum number of stored image files in the target directory. When exceeded, the oldest files are removed.

Examples ​

Storing Frame with Dynamic Path and Custom Name ​

Writes frames from camera streams into device-specific directories with custom file names:

json
{
  "id": "rule_camera_save",
  "sql": "SELECT deviceId, image, ts FROM cameraStream",
  "actions": [
    {
      "image": {
        "path": "/data/captures/{{.deviceId}}",
        "format": "png",
        "imageField": "image",
        "fileName": "{{.deviceId}}_{{.ts}}.png",
        "maxAge": 24,
        "maxCount": 500
      }
    }
  ]
}

rekuiper is open source (Apache-2.0 / MIT) · For an all-in-one MQTT broker with embedded rekuiper rules, see IndraMQTT.