how to change Texture Max Size with scripting

followed a bit this and cant seem to find how do I change Max Size

it can be found in inspector

Max Size

using UnityEngine;
using System.Collections;

public class GuiFloat : MonoBehaviour {
	public Texture2D Leaves;
	void Update(){
		Leaves.texelSize = (new Vector2(32,32));

I’m almost sure .texelSize isn’t right one for that

but how do I change that value by scripting?

then (untested)

    string imgAssetPath = AssetDatabase.GetAssetPath(Leaves);
    TextureImporter ti = new TextureImporter();
	TextureImporterSettings tis = new TextureImporterSettings();
	ti.ReadTextureSettings (tis);
    ti.maxTextureSize = 32;
	ti.SetTextureSettings (tis);
	AssetDatabase.WriteImportSettingsIfDirty (imgAssetPath);
	AssetDatabase.ImportAsset(imgAssetPath, ImportAssetOptions.ForceUpdate);