Skip to content

Instantly share code, notes, and snippets.

@tijmenb
Created April 11, 2012 16:15
Show Gist options
  • Save tijmenb/2360303 to your computer and use it in GitHub Desktop.
Save tijmenb/2360303 to your computer and use it in GitHub Desktop.
Compare a bunch of images to find duplicates
files = Dir.glob("*.png")
compares = {}
files.each do |file|
files.each do |compare_to|
key = [file, compare_to].sort.join("-")
unless compares[key] || file == compare_to
compares[key] = `compare -metric MAE #{file} #{compare_to} null: 2>&1`
puts "#{file} vs #{compare_to} = " + compares[key] # if a comparison yields `0 (0)`, they're the same
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment