Absolute path on load() not working on Godot 3.0

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

For some reason, the folowing code works on Godot 2.1.4:

func _ready():

var a = load(“/home/username/images/image.jpg”)
print(a)
pass

returns:
[ImageTexture:555]

But on Godot 3.0 the same would return a [Object:Null]
even if i use ResourceLoader.load()

What changed?

(Running on Ubunut Mate 17.10)

I am facing the same issue too and definitely need this feature !

As stated by @ QuentinCaffeino and following this link :

http://docs.godotengine.org/en/3.0/getting_started/workflow/assets/importing_images.html

In Godot 3+, image files are no longer native resources and they must be imported. The reason behind this is the large amount of configuration parameters that image files can be imported with.

This doesn’t make sense, so we can’t load pictures / textures downloaded from the internet to the phone ? or loading pictures from phone gallery upon run-time ?

Would appreciate if anybody has a solution / hack for this issue.

Thx in advance

GameVisitor | 2018-04-09 08:49

:bust_in_silhouette: Reply From: QuentinCaffeino

Because godot3 can’t load images without import files.
I don’t understand it either. Import files are generated when you import image in engine or place your image in game-dev directory and have engine opened.

:bust_in_silhouette: Reply From: GameVisitor

I found this thread that worked for me (Should work for you too):

https://forum.godotengine.org/23713/how-to-convert-image-to-texture

The answer in the thread is Windows based (F:/pictures/) but worked for me on Ubuntu 16.04 LTS