Convert a base64 string of a jpeg to a texture or surface

Hi embers,
I receive from a websocket server a jpeg from a canvas on a web page:
var imgData = canvas.toDataURL("image/jpeg"); window.socket.emit('canvas', imgData);

In my Cinder app, the message is received as a string, see screen capture below:

How can I convert this string to a texture?
Thank you for any hint.

Hi,

use Cinder’s base64 functions to convert the data to a JPEG file again, then use loadImage to load it from memory.

-Paul

2 Likes

thank you @paul.houx it worked!

Texture sharing between html canvas and Cinder

1 Like