Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 8

Re: issue with base64 encoded image

I found my old SDK1 code for this. You can use `filename`  as a URI with a poster and you should see the image.
filename = "tmp:/test_file.jpg"
b64 = <b64 String for a JPEG>
ba = CreateObject("roByteArray")
ba.FromBase64String(b64)
ba.AppendFile(filename) 

canvasItems.push({url:filename,TargetRect:{x:10,y:10,w:107,h:60}})
m.canvas.SetLayer(1, canvasItems)
m.canvas.Show()
   
0 Kudos
Highlighted
Level 7

Re: issue with base64 encoded image

Thanks, tim_beynart to recall your code.
thanks a lot again.
0 Kudos
Highlighted

Re: issue with base64 encoded image

I have find this similar solution in Python language.

Base64 encoding enables us to convert bytes containing binary or text data to ASCII characters. By encoding the data, we improve the chances of it being processed correctly by various systems. Some systems don’t understand the data in bytes format, so we have to convert the data.

To convert the Image to Base64 String in Python we have to use the Python base64 module that provides b64encode() method. 

The purpose of the base64.b64encode() method in Python is to convert the binary data into ASCII-safe “text”. But Python strongly disagrees with that. Python is now very strict about this that bytes.encode() method doesn’t even exist, and so ‘xyz’.encode(‘base64’) would raise an AttributeError.

0 Kudos