Universal Robots Forum

Sending Image from Daemon

I am trying to send an image from my daemon (cpp) to the installation node through XML-RPC.
What is the best way to do this?
I have tried base64, but couldn’t understand how to receive it in Java.

I have also tried to send an array of strings (each string is a row, and each char is a pixel 0-255), but i got this error:
org.apache.xmlrpc.XmlRpcException: Unexpected error executing code for particular method, detected by Xmlrpc-c method registry code. Method did not fail; rather, it did not complete at all. 200-byte supposed UTF-8 string is not valid UTF-8. Unrecognized UTF-8 initial byte value 0xff

Send image data as base64 and here is the code I used to create the image on java side. image

(imageData) is the data received through whatever communication you end up using. It’s been awhile since I touched this code but the image is pulled of an html website converted to base64 in python then sent over to URCap which converts it into an image.

1 Like

@roman.reiner Thanks for the answer, although you must have skipped through the most important part :slight_smile: the definition for imageData, and how to convert it back to an Image.

BTW, how can a whole image fit in a 1D byte array? how would it know the height and width when parsing back?
My client is a cpp deamon, not Java, and my image is represented in a 2D byte array.