Solved by zetyquickly in post #2 
              
              
                Hi, @ArshadIram 
I suspect that it is saving only 3 images due to the highlighted line within a if statement that is called three times. Try to indent left that line that might help