Save canvas as JPG and Print Job

Monkey Targets Forums/HTML5/Save canvas as JPG and Print Job

Origaming(Posted 2012) [#1]
Hi,

We're in the middle of a dressup game which requires Save and Print functionality. We have scoured through the forums and docs but we're unable anything about them.

Are we missing something?

Googling found out this article on html5 canvas to JPG:
http://www.nihilogic.dk/labs/canvas2image/
But if only I know just how to implement those into Monkey easily...


Soap(Posted 2012) [#2]
You don't have to implement it in Monkey - you can include the source in the html file which also has your game's canvas. Then have a button below the canvas to save screenshots whenever. Or you can implement a button which calls the functions and waits for things to complete before continuing.

view-source:http://www.nihilogic.dk/labs/canvas2image/

Viewing the source there it looks very simple to setup for any game canvas. The id of his canvas is "thecanvas" - replace that with the id of your game's canvas and test his code as is. I do not see why it would not work. How you implement it is up to you either in game or out of game.


Origaming(Posted 2012) [#3]
Thank you Soap.
Now I realize I should have posted this in General Monkey forums as I need this feature generally, to work across platforms.

I'll try that code later and see if it works.