Created
October 7, 2022 03:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
License: (CC0 1.0 Universal) You're free to use this however you like, credit is not required but appreciated :D
generated folder structure
saved images within folder