added saving as image functionality