Image to binary string

I’m using the cognetive service from azure v2.1 to process images and save the jsonfile. The get seems to wrk, but the post who needs to return the endkey for the get keeps getting errors fpr the image. I tried to attach it as an attachement, I tried to enter the file location in the body and set it to json, now I want to try to pass the binarycode in the body using octet-stream, but I can’t seem to find how to convert an image to binary in uipath. I’m using the http request activity to do my api calls, I tried it in postmen and there everything works. Anyone know how to convert an variabele image to binary or has an other way to solve my problem?

Hi @Daniel_D

Use byte b =file.readallbytes(filename)


Nor the objectclass, nor the instancevariable has a method called readAllBytes

Hi @Daniel_D
create a file variable

Ashwin S

It returns an array with 3280564 values, if I have to loop al that to create the string. And also that’s base64, I need binary (bit), this I could have achieved with image.ByteArray

I have the same issue please let me know if you managed to solve it @Daniel_D

In which type of object in Uipath is your image ? Or is it saved on disk as something like a jpg file?

yes it’s locally saved, I tried to load the image and use the uipath activity too, but that dosn’t return json

I worked around it, I wrote a small console application that converts and sends the image and call that from uiPath. If you want I can share it

Please share

Sorry I ave been bussy, I will tonight

With tons of delay, but finally… (256.1 KB)
To invoke it in your uiPathApp see screenshot