Changed ImgToTile program to allow cancelling