I am been really struggling on this problem and thought it was time to reach out. I need to convert a KNIME Binary Object (an image binary return from an API) to a Base64 string so I can use it in PowerBI to display an image in a dashboard.
I have tried everything I can think of to get the Binary to Base 64 and I have been unsuccessful.
I need to end up with a string output something like this:
My data from the GET:
My data after Binary To String with ASCII set as the Decode:
I am not very proficient in JAVA and wrote this to try to convert the Binary to a Base64 string:
The JAVA Snippet outputs this:
I tried in Python as well and ended up with a similar result:
import base64 import pandas as pd input_table_1['body_encoded'] = [base64.b64encode(x.encode('ASCII', 'strict')) for x in input_table_1.body] print(input_table_1['body_encoded']) output_table_1 = input_table_1
The output from my Python Script
It just doesn’t look like the Base64 I’m getting from the online conversion tools. I am open to a JAVA, R or Python solution to this if anyone has any ideas/suggestions. I really appreciate it!