Filipp_BSG
Member
I want to let user to load an image into the game via file select dialog. In JavaScript this is done by using the standart FileAPI, which can return a string representing the loaded image encoded in base64 like this:
The question is how to convert this string to image inside GM:S. I tried directly passing it to sprite_add as the first argument, using buffer_load/buffer_read/buffer_base64_decode combinations before passing, but no result. AFAIK, buffer functions won't work porperly with buffers created outside of GM:S. I see two really lame workarounds:
Code:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACE8AAAalCAYAAADE...
- Upload image to server, then load it back via http_get_file and sprite_add;
- Create an <img> element and manipulate it via JS, which is only suitable when the image is going to be (almost) static, which is not my case.
Last edited: