Richtextlabel img tag

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

I need to show a custom image created via gdscript in runtime inside a [img] tag of a RichTextLabel.
As I can understand, it´s no possible to import resources in runtime due to the .import file needed and only created throught the editor importing system. So, creating the image and saving it in user path doesn´t work.

The [img] tag only loads disk files? Is there any way it can show a Image variable instead? If not, would be a fancy property to add.

Thx

This is more like a feature request to me.
I think you can post this issue at Issues · godotengine/godot-proposals · GitHub

volzhs | 2019-09-19 13:20

:bust_in_silhouette: Reply From: Drillur

You can use the .get_path() method on texture variables (and probably other kinds of loaded objects), which returns a string of their path in the file system.

To add the image to a RichTextLabel, you can do something like
"[img]" + image_variable.get_path() + "[/img]"

I found this thread because, now that I’ve found this out, I’m trying to change the size of the image. >:(