Well the following will get you all the sizes of the photo (and stick it in a log file in this test).
path="A/CHDK/LOGS/"
file="Size"
file=path..file..".txt"
io.output(io.open(file,"w"))
path="A/DCIM/100CANON/"
File_Table=os.listdir(path,false)
for i=1,#File_Table do
filename=path..File_Table
INFO=os.stat(filename)
io.write("Filename: "..filename.." size = "..INFO.size.."\n")
end
io.close()
If you know how many pictures you have take for evaluation, you can delete (os.remove) the smaller files and only keep the largest one.
Don't know how valid this approach is to getting the best photo but it definitely can be done.
Best,
Mac