OK. I've made it half way around.
I solved the problem with the JPEG output (convert GRID to jpg and delete GRID), however, the problems with speed and large shape file are still there.
For clipping an image size 1000x1000 pixels it takes for about 10 minutes! How to speed up the process?
BTW, I have polygon shape file representing surface area of roads, however, since my images cover a larger area, I need to clip them before analyzing them in terms of crack detection..
See the attached code.
Thanks for your suggestions,