added some implementations for writing out the image data