NWjs - Write File in ".png"

Get help using Construct 2

Post » Tue Feb 07, 2017 10:33 pm

I need to save as PNG-file my CanvasSnapshot.
"Brower.InvodeDownload" can do it, but "NWjs.WriteFile" creates the unreadable file in PNG-format.

Is there any way to do it?
B
44
S
18
G
32
Posts: 115
Reputation: 19,441

Post » Tue Feb 07, 2017 11:25 pm

InvokeDownload works perfect and can save *png.
Why would you need to use anything else?
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

Post » Tue Feb 07, 2017 11:25 pm

To cut a long story short I have found the solution by myself.
We should use "tokenat(CanvasSnapshot,1,",")" instead of just "CansavSnapshot".
Also we should find "writefile" function in "c2runtime.js", go 5 steps down and change "UTF8" with "Base64"
B
44
S
18
G
32
Posts: 115
Reputation: 19,441

Post » Tue Feb 07, 2017 11:30 pm

XpMonster wrote:InvokeDownload works perfect and can save *png.
Why would you need to use anything else?

Because I am creating a program like "Spriter" and I do not want user to click LMB every time my program saves the image.
B
44
S
18
G
32
Posts: 115
Reputation: 19,441

Post » Tue Feb 07, 2017 11:39 pm

Well if your program will be more like thing we had in Construct Classic I would be more than glad to purchase it! Best of luck.
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

Post » Wed Feb 08, 2017 12:01 am

XpMonster wrote:Well if your program will be more like thing we had in Construct Classic I would be more than glad to purchase it! Best of luck.

Thank you. I will try my best.
B
44
S
18
G
32
Posts: 115
Reputation: 19,441


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests