What exactly these functions of Image do?

I wanted to load Images from storage turns out I can’t load not imported images (i.e Non project images). So in my research (looking the document) I found two functions Image.load(String path) and Image.load_from_file(String path) what are these functions do? Your consideration is appreciated.

1 Like
extends TextureRect

func _ready():
	
	#load image from somewhere on computer
	
	var v_image = Image.load_from_file("C:/Users/DudeWhereMyShrooms/Desktopp/icon.svg")
	if(null == v_image):
		
		#warn if not found
		print ("image not found")
		return #and exit function
	
	#print something about image
	print("image size:", v_image.get_size())
	
	#create texture from image
	var v_texture = ImageTexture.create_from_image(v_image)
	
	#set TextureRect's texture
	texture = v_texture

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.