How to reimport png files with other settings via script/code

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: 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?

:bust_in_silhouette: Reply From: creativeape

You can use Image.load_png_from_buffer

var f =
var err ="img.png")
if err:
    print("something went wrong: " + str(err))

var img_buffer = f.get_buffer(f.get_len())

var img =

# you now have an Image, loaded as png from file.

# to create a Texture using this image:
 var tex =