I've misread your code. That raises the question of why you have the first and third loop simply copying the filenames into an array without filtering, and the second loop looking for images but doing nothing with them (relatively speaking).
Anyway, here's my (incomplete) interpretation of what you are trying to do:
ImageCount = 0
NonImageCount = 0
NumberInList = 0
dim Filename$(1000)
perform checklist for files
for i = 1 to checklist quantity()
print checklist string$(i); at(320, get cursor y());
ExtensionStart = last instr(checklist string$(i), ".")
if ExtensionStart > 0
Extension$ = lower$(remove$(checklist string$(i), 1, ExtensionStart))
else
Extension$ = ""
endif
if instr("|bmp|jpg|png|tga|dds|", "|" + Extension$ + "|") > 0
` Could load the image here as well as add it to the Filename$ array
print "Is an image"
inc ImageCount
Filename$(NumberInList) = checklist string$(i)
inc NumberInList
else
print "Is not an image"
inc NonImageCount
endif
next
print ""
print "Images: ", ImageCount
print "Non Images: ", NonImageCount
print "Number In List: ", NumberInList
print "All Files: ", checklist quantity()
wait key
cls
for i = 0 to NumberInList-1
print i, " ", Filename$(i)
Img = find free image()
load image Filename$(i), Img
next
wait key
You'll need to adapt it to fit your program and to add the bits I didn't see the need to code in this example.