Topic was automatically imported from the old Question2Answer platform.
Asked By
RastaJoe94
I want to load many png files at runtime. Some of them should be imported as Image and others as unfiltered Texture. I am also saving Images to png at runtime as unfiltered Textures. How can I specify importsettings of a Resource via C# or GDScript?
var f = File.new()
var err = f.open("img.png")
if err:
print("something went wrong: " + str(err))
return
var img_buffer = f.get_buffer(f.get_len())
f.close()
var img = Image.new()
img.load_png_from_buffer(img_buffer)
# you now have an Image, loaded as png from file.
# to create a Texture using this image:
var tex = ImageTexture.new()
tex.create_from_image(img)