changed imshow to imwrite