Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | amberlimshin |
I have a painting game, I want to save the player’s painting/viewport as a png.
Here’s my code:
func save_painting():
var masterpiece = get_viewport().get_texture().get_data()
masterpiece.flip_y()
masterpiece.convert(Image.FORMAT_RGBA8)
var save_path = "res://Minigames/paint/input/Masterpiece.png"
masterpiece.save_png(save_path)
But I keep getting this error log:
ERROR: Can't save PNG at path: 'res://Minigames/paint/input/Masterpiece.png'. at: save_image (drivers/png/resource_saver_png.cpp:56) - Condition "err" is true. Returned: err
It works ok in Godot but once exported it causes a crash. Tried for days to solve this myself to no avail. Please help!
Thank you!
Do you have write permission to said location? Try running the exported game as administrator and see if that makes any difference.
Ninfur | 2022-06-17 14:35