Added functionality for saving ImageData objects