Saves a screenshot of the game as a *.png.


GML Code Example


Argument Description
fname The filename for the screenshot to save

Returns: N/A


With this function you can save a screenshot of the game as it currently appears in the game window or browser. The file will be saved to the working directory of the game, which in windows is located at "C:\Users\YOURUSERNAME\AppData\Local\YOURGAMENAME\" This is an image of the whole display region and not just a specific section or view and your are saving out what is being drawn to the back buffer at the time, meaning that depending on where you call the function the results will differ. If you don't want the GUI layer, then you can save the screen before rendering the GUI (ie: in the Draw event), but if you do want GUI elements to be included, then you save after the Draw GUI event. Should you need more control, you should use the function screen_save_part.

NOTE: This function does not work on the HTML5 target.


GML Code Example

if keyboard_check_pressed(ord("S"))
    screen_save(working_directory + "\Screens\Screen_"+string(num)+".png")
    num += 1;

The above code takes a screenshot of the game when the user presses the "S" key. This screen shot is saved to a specific directory and numbered using a variable which is then incremented.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here