I need to store user-drawn images from an online whiteboard. The amount of data gets huge quickly which is obviously not good. What I need is to store something drawn through a tablet for example in as little space as possible without too much of accuracy loss as for example letters should be distiniguishable. Bonus points for a solution with the ability to determine when what was drawn.
1 Answer
Don't store the rasterized image instead store the drawn strokes as vector graphics. Those should compress pretty well.
Adding timestamps to each stroke should then be very simple.
You can caching the rasterized image during execution to avoid needing to rerender every stroke every frame.
-
$\begingroup$ What happens when someone wants to erase, and how do I approximate strokes if the user can draw whatever shape the want? $\endgroup$ Oct 12, 2018 at 10:12
-
1$\begingroup$ Erasing is drawing with the background color. You can use a series of splines to approximate each stroke. $\endgroup$ Oct 12, 2018 at 10:57