added WriteImage helper function to Context interface

Something I've found useful so feel free to use if you wish.