Added sample saving to image