Saving user renders as their profiles on a database

Hello!
I use treejs to render users avatars (they can customise them with hats clothes and others example|500x500 )

I use a 3d render that spin the avatar slowly.
Is there a way to save a png or jpeg of a frame of the spinning avatar once it has loaded it? I saw it was already asked how to save an image, but I don’t need to download the file, I need to directly save the image on a folder in my database on a shared hosted.

Can you please help me?

It works essentially the same way - just without triggering the download. If you enable Renderer. preserveDrawingBuffer, render the frame and then use Canvas.toDataURL - you’ll get the image in form of a base64 string.

You can save that string in the database.

2 Likes

Thanks a lot!