Skip to content
STAGING SERVER
DEVELOPMENT SERVER

Basler Vision Connector Messaging: Image Format#

To standardize image transfer between camera streaming applications and image-driven applications, use the following format for transferring images. The ZeroMQ message consists of a multipart message with each frame/part described below.

This message format is prepared to support the streaming of multiple cameras.

The following image format namespaces are supported via this communication channel:

Message Envelope for ZeroMQ Messages on the Pub/Sub Channel#

Frame Field Description Type
1 topic Device identification Binary string (UTF-8) to identify the device in the following syntax: device/{DeviceID}/stream
2 metadata Metadata Binary metadata JSON (UTF-8)
3 image Image 1 Binary
4 … n image Image n - For multi-stream camera Binary

Metadata JSON#

Field Optional Type Default Description
version No String 1 Metadata format version
count No Integer (32-bit unsigned) 1 Number of images in the message
timestamp No String - Date and time string UTF-8 ISO8601. Application host datetime
detail No Image Detail Object Array - Images details

Image Detail Object#

Field Optional Type Default Description
FormatNamespace Yes String GenICam Image format namespace. For GenICam pixel format, use GenICam and use Compressed for compressed formats.a
Format No String – Image formata
Width No / Yes (encoded formats) Integer – Image width
Height No / Yes (encoded formats) Integer – Image height
LinePadding Yes Integer 0 Number of bytes added at the end of the byte stream to reach a multiple of 4 bytes. For example, an image with 61 pixels, mono8, will have a line padding of 3, filling the stream to reach 64 bytes.
ImageData No / Yes (for MQTT) String – URI with the image data or a reference to the image data.b This field is mandatory for ZeroMQ and isn't available for MQTT.

  1. The following image format namespaces are supported via this communication channel:

    • To send uncompressed images: namespace GenICam. Use The pixel format names from the GenICam pixel format naming convention as described in GenICam_PFNC_2_4.pdf in the format field.
    • To send compressed images: namespace Compressed. The only supported value for compressed image formats in the format field is JPEG.

  2. A proprietary message part URI with MIME-Type is used here. It references raw data in another message part.
    Syntax: msgpart:{Message-Part-Index};{MIME-Type}
    Examples:
    - For GenICam image data: msgpart:2;application/octet-stream
    - For

JSON entry carrying an error:#

Field Optional Type Default Description
Error No String – An error description with the reason for the error

Metadata Examples#

{
  "Type": "Image",
  "Data": {
    "FormatNamespace": "Compressed",
    "Format": "JPEG",
    "Width": 80,
    "Height": 60,
    "ImageData": "msgpart:2;image/jpeg"
  }
}
{
  "Type": "Image",
  "Data": {
    "FormatNamespace": "GenICam",
    "Format": "Mono8",
    "Width": 640,
    "Height": 480,
    "LinePadding": 0,
    "ImageData": "msgpart:3;application/octet-stream"
  }
}
{
  "Type": "Image",
  "Data": {
    "Error": "Some error message."
  }
}