Add imwrite function