Quick and easy solution -
- drag the screen along the fixed grid
- store fragments separately, indexed by a strong hash (to exclude duplicates, even between users)
- save the whole screen as a 2-dimensional hash array.
- restore the original screen in the browser from hashed fragments.
Switching from one screen to another, very similar, would be a matter of loading just a few fragments, so your compression there.
Implement a simple link counting scheme to remove tiles again. You might also want to share portions of the screen between users to further reduce storage.
Experiment with different tile sizes to see which one works best; this may depend on screen resolution, user activity, and the graphic format used to store items.
Image processing in Python can be done using PIL .
source share