HURRAY
NW.JS Write File > Browser.ExecJS("atob("""&tokenat(Sprite.ExtractImage.currentImage,1,",")&""")")
This finally works, and saves a PNG file representation of the Sprite in the specified folder automatically
I mentioned ExecJs + atob() a few posts above, and couldn't get the quotes right, then I dug out this post
The link to the video tutorial that James linked is gone, I found it again
thanks to the title
For general screenshots on disk: Browser.ExecJS("atob(""" & tokenat(CanvasSnapshot, 1, ",") & """)")
Now this method doesn't work (anymore?), and produces the same corrupted image I had in other tests
I also had to edit the original NW.JS plugin, and exchange the Write File encoding from "utf8" to "binary"
This now works, and here's the change below, with a UI mockup to hopefully have it for the official plugin
Runtime.js
Acts.prototype.WriteFile = function (path_, contents_)
{
if (!isNWjs)
return;
try {
fs["writeFileSync"](path_, contents_, {"encoding": "binary"});
}
catch (e)
{}
};[/code:1y0o2ik8]
Suggestion
[img="http://i.imgur.com/LiJ3EH3.png"]
Also while I'm at it I added another suggested option to choose between Synchronous/Asynchronous
Like rexrainbow [url=https://www.scirra.com/forum/request-nw-js-write-image-file_p1029199?#p1029199]mentioned[/url], it would be worth having to maybe improve performance in some cases
Anyway, I think it's important to have a way to save live screenshots or batch of image on desktop apps
@Ashley can you have a look at this suggestion for the nwjs plugin?