I have made something similar where I can select a photo and have it saved.
Although I am using NWjs and the paster object to make it easier.
The idea is that I have a variable called 'savedphoto' and when the user loads in the image, the variable takes the image data. It then loads back this variable when a save is loaded as the variable is saved.
Let me know if there are limitations on using either NWjs and Paster object and I can put a little example together if you need?