Skip to content

Instantly share code, notes, and snippets.

@GK-GreyGhost
Created October 7, 2022 03:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GK-GreyGhost/4dccd01c46c53c616928079f155d3dbf to your computer and use it in GitHub Desktop.
Save GK-GreyGhost/4dccd01c46c53c616928079f155d3dbf to your computer and use it in GitHub Desktop.
Create a folder in the format year-month-day and save the screenshot
func screenshot():
var img = get_viewport().get_texture().get_data()
img.flip_y()
var dir:Directory = Directory.new()
var now = OS.get_date()
var folder:String = 'user://screenshots/%s-%s-%s' % [now.year,now.month,now.day]
dir.make_dir_recursive(folder)
img.save_png(folder+'/%d.png' % OS.get_unix_time())
@GK-GreyGhost
Copy link
Author

License: (CC0 1.0 Universal) You're free to use this however you like, credit is not required but appreciated :D

generated folder structure
image
saved images within folder
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment