Identifying duplicate photographs

A simple algorithm to identify duplicate photographs in a directory using fingerprinting.

package require vectcl
package require vectcl::tk
package require Tk
package require Img


proc findduplicates {flist} {
        set matches {}
        set photo [image create photo]
        foreach fn $flist {
                puts "Processing $fn" ;# for progress
                $photo read -shrink $fn
                vexpr {        
                        img = fromPhoto(photo)
                        fprint = int(sum(sum(img[0:-1:10,0:-1:10,:])))
                }
                dict lappend matches $fprint $fn
        }
        
        return [dict values [dict filter $matches script {k v} {
                expr {[llength $v]>1}
        }]]
}

set liste [glob /Users/chris/Foto/tmp/*.jpg]

puts [join [findduplicates $liste] \n]