Search code examples
opc-uamilo

Support to read images via OPC UA with eclipse milo


I just found in the OPCUA specification that images are supported (BMP, GIF, JPG and PNG) (see link). I also went through the org.eclipse.milo.opcua.stack.core.Identifiers and I see that types exist to handle those image formats:

    public static final NodeId ImageBMP = init(2000);
    public static final NodeId ImageGIF = init(2001);
    public static final NodeId ImageJPG = init(2002);
    public static final NodeId ImagePNG = init(2003);

The question is, has milo currently support for reading those image formats via OPCUA? Any example of how to do it?

Thanks!


Solution

  • You just read the Value attribute like any other VariableNode.

    The result will be a ByteString. Those NodeIds you found are the ids of alias/simple DataTypes that inherit from ByteString and serve as a hint to what the contents of the ByteString will be.

    It’s up to you to turn the bytes into an image after that - it doesn’t have anything to do with OPC UA or Milo at that point. You’ll probably want to look at the ImageIO API.