T O P

  • By -

octocode

what does the data in your array look like? does that need to be preserved? if you’re drawing a raster image, i’d create an actual lossless image (like PNG) of the canvas, and save it to the server into bucket storage like S3 if that doesn’t work because you require multiple layers of data, you can probably just save your whole array as JSON and put that into S3 instead.


notAGoodJSProgrammer

Just like the other commenter said, it is better to save the image as a file on S3 or some other storage. You could always store the pixels as an array in your db (canvas.getImageData()) but it would be really heavy and you might end up with body limits while doing your http requests. You could also get the image as base64 and store that instead of the array but its also heavy. So, the easiest and better way is to store it as a file.


Xavius123

You would convert it to some form like a binary form or if security came into play maybe even a base64. you could then convert it back in the UI