How do I load a png from file system to the game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ashish

Now, that I am able to save a screenshot in the file system, how do I preload it as the texture of a textureRect when the I play the game the next?

:bust_in_silhouette: Reply From: Inces

When You saved it into the file system , You can see it as resource and use it as all of your images. Just like you insert any .png file into your sprite. So You should take path where you saved your screenshot and preload it with it.

Unless You didn’t save it into “res” folder and don’t see it ?

Or do You mean You want to preload this image right after taking screenschot, when the project is still running ? If so You should use load(), but when You create image You don’t need to load it again, just make sure to keep reference to it on creation.

Thanks a lot.
I did use “res://screenshot.png”.
Clears a few more things than just the question that I asked.

ashish | 2021-10-01 11:25