Resource Loader can't load jpg?

Godot Version

4.5 stable

Question

I save a jpg file as a little thumbnail for each savefile i create. The jpgs are created from the Image class and are saved with the “save_jpg” function.

For loading i wanted to do some threaded loading, while they’re not big, there could be many of them and i just want to avoid blocking the main thread. However ResourceLoader apparently can’t detect jpgs?

When i try to check if they exist or try to load them, i just get the following error:

E 0:00:02:178   _load: Resource file not found: user://saves/quicksave1/image.jpg (expected type: Image)
  <C++ Error>   Method/function failed. Returning: Ref<Resource>()
  <C++ Source>  core/io/resource_loader.cpp:351 @ _load()

However “FileAcces.file_exists()” actually gives me a true, so the file definitely exists.

For now i load it blocking through the image class:

if FileAccess.file_exists(ImagePath):
				var ImageTextureRef = ImageTexture.create_from_image(Image.load_from_file(ImagePath))
				if ImageTextureRef:
					SaveImage.texture = ImageTextureRef

Does anybody know why ResourceLoader apparently can’t detect jpg files? From what i’ve seen it is supposed to work as “Image” is a Resource. Or do i miss something?

Thanks in advance!

ResourceLoader can only load Resources imported in the engine first as explained in its description:

Note: You have to import the files into the engine first to load them using load(). If you want to load Images at run-time, you may use Image.load(). If you want to import audio files, you can use the snippet described in AudioStreamMP3.data.

You can check this documentation page about loading files at runtime:

1 Like

Darn, guess i missed that part.

Oh well, thanks anyway!