Added convenience function to save a buffer

This is not very elegant but writing a raw buffer created by some other program to an image is a common task. We should provide a convenience function for that.