Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | DimitriyPS |
In my project provided by the save game. In addition to the game data, I save a screenshot (previews). The screenshot I save is as follows:
yield(get_tree(),"idle_frame")
yield(get_tree(),"idle_frame")
Image=get_viewport().get_texture().get_data()
Image.flip_y()
Image.resize(1280,720)
Image.save_png("user://1.png")
Then I upload this image for viewing:
TextureRect.set_texture(load("user://1.png"))
And then I have 2 problems:
-
After application of the method:
Image.resize(1280,720)
I get a completely black image of the specified size. Without this method, it is stored correctly. -
TextureRect.set_texture(load("user://1.png"))
- it worked in Godor 2, but it doesn’t work in Godot 3.
FYI, if you use Image
as variable name, it will overwrite the actual Image
class, preventing you from using it ever again… due to this bug: GDScript classes can be replaced by anything · Issue #8791 · godotengine/godot · GitHub
Zylann | 2018-02-16 22:36
No, I don’t use Image as the variable name. This also applies to TextureRect. I changed their names so as not to explain what class they were.
DimitriyPS | 2018-02-19 13:44