In my new game, most of the gameplay is to share images of your decor.
I take a photo of the screen and get base64_img
screenshot.html5(function(self, base64_img)
-- local screenshot_img = image.load(base64_img) (not working)
end)
Is it possible to make base64_img in gui texture?
I would be grateful for your help!
britzl
August 25, 2019, 8:17pm
2
You want to use the image as a texture in a gui node? If yes, then start by decoding the image (there’s Lua examples here: lua-users wiki: Base Sixty Four ). Then use image.load() and gui.new_texture().
2 Likes
Thank you very much! It really works!
screenshot.html5(function(self, base64_img)
-- cut data:image/png;base64,
base64_img = string.sub(base64_img, 23)
screenshot_png = dec(base64_img)
screenshot_img = image.load(screenshot_png)
-- screenshot_img ready to use
end)