Create a normal map using a script?

I don’t have a software that can create normal maps from an image so I usually make a grayscale image and then let unity make the normal map from that image. But I can’t save the image to use for later, Instead I have to convert it to a normal map every time I use it. So how would I make a normal map from a greyscale using a script? i prefer c# but js works fine.

If you only need to make a texture you can use NormalMap-Online here. Allows you to turn any PNG 512x512 into a normal, displacement, occlusion or specular map. You can also download GIMP addons which will allow you to use any resolution.