Save a material preview to file

How does one save a material preview to a png file?
Also, in case there’s no preview, is there a way to force blender to produce one (with size specifications) and then save that to a png file?