Modifying textures like TextureImporter does with normal maps importer, but run a custom shader

I was wandering if it is possible to create a tool that runs a texture through some custom shader and saves it in a new one, in the editor.

Pretty much like unity can make a normal map from a height map.

Right now I’m reading the information from a texture at runtime and converting a height map with my fragment shader to UV offsets and applying the results.
This does not need to be done at runtime so I want a solution to bake the results into a texture.

I solved it myself by inheriting the AssetPostProcessor and overwriting the texturePostProcessor for a particular folder.

class DuDvGenerator : AssetPostprocessor {
	void OnPostprocessTexture ( Texture2D texture ) {
                // Modify Texture here and apply.

Note that this script must be under a folder called “Editor”.