added saving to image functionality