Change texture type in script?

hi
I want to change texture type to (GUI), can I change it with script?

Short answer is yes.
Read about it here: Unity - Scripting API: TextureImporter