I've been trying the following for a very long time, with no success :(

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

I’ve been trying the following for a very long time, with no success :frowning:

I have an image saved in the C:\Users\My Name\AppData\Roaming\Godot\app_userdata\Calori folder (Calori is the name of my project) which I presume can be accessed by saying user:// using GDScript.

But after creating a variable called image_path with the path to this image in the user directory, I get the following error :frowning:

E 0:00:03.975   _load: Resource file not found: user://image.jpg.
  <C++ Error>   Condition "!file_check->file_exists(p_path)" is true. Returned: RES()
  <C++ Source>  core/io/resource_loader.cpp:282 @ _load()
  <Stack Trace> objects.gd:7 @ _ready()

Any help would be greatly appreciated!

:bust_in_silhouette: Reply From: omggomb

load can only be used with imported resources, meaning the ones that are in the res:// folder. You will need to use Image.load():

var image = Image.new()
var image_texture = ImageTexture.new()

See here for all the details: ImageTexture — Godot Engine (stable) documentation in English

The relevant part being:

This is because images have to be imported as StreamTexture first to be loaded with @GDScript.load.