AssetDatabase.ImportAsset fails on generated textures

I’m trying to generate a number of PNG icons from 3d objects in Unity. Generating and saving the images works fine, but I can’t seem to finish the process of saving the new assets to the database. When I attempt to use AssetDatabase.ImportAsset(), it fails with the following error:

Could not create asset from Assets/Artwork/Resources/Icons/Insertions/Carnation - Light Blue.png: Texture could not be created.
UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
Editor.IconGenerator:SaveTextureToPNG(String, Texture2D) (at Assets/Code/Editor/IconGenerator.cs:95)
Editor.IconGenerator:GenerateInsertionIcons() (at Assets/Code/Editor/IconGenerator.cs:38)
Editor.IconGenerator:GenerateAllIcons() (at Assets/Code/Editor/IconGenerator.cs:17)

That path is directly from a previous reference to the asset, so I don’t understand why it fails. When I check in the inspector, the new assets exist, and the settings are actually changed, but they haven’t been applied.

Here’s a snippet of the larger script:

TextureImporterSettings settings = new TextureImporterSettings();
settings.alphaIsTransparency = true;
settings.alphaSource = TextureImporterAlphaSource.FromInput;
settings.sRGBTexture = true;
textureImporter.SetTextureSettings(settings);
EditorUtility.SetDirty(textureImporter);
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);

@Forberg is right! You need to initialize the rest of the settings in the TextureImportSettings object. The easiest way I found to do this was to first use: textureImporter.ReadTextureSettings(settings);, then you can make your changes, and set it again.